- Java code
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;public class InputStreamTest { public static void main(String[] args) { BufferedReader in= new BufferedReader(new InputStreamReader(System.in)); try { System.out.println(in.read()); in.close(); } catch (IOException e) { e.printStackTrace(); } }}
InputStreamReader是字节流通向字符流的桥梁,感觉很奇怪,InputStream的read方法是读取一个字符,而InputStreamReader是读取字符的,怎么输入30,却输出51????
------解决方案--------------------