public class ReaderConsole {
public static void main(String[] args) {
try{
System.out.println("请输入字符串:");
//数组来缓冲
byte[] b = new byte[5];
//读取数据
int n = System.in.read(b);
//转换为字符串
String s = new String(b,0,n);
System.out.println("输入的字符串为:" + s);
}catch(Exception e){}
}
}