IO流的一个问题,关于汉字的输入和输出
最近在学习IO流,遇到一个难题,看下面的代码:
public static void main(String[] args) throws IOException {
InputStream in=System.in;
int ch=in.read();
System.out.println((char)ch);
}
在控制台输入字符a,可以在输出a。但是如果想输入一个汉字,如何输出一个汉字呢?有个要求,就是实现时不能使用InputStreamReader和OutputStreamWriter。