java api中这样描述System.in
in
public static final InputStream inThe "standard" input stream. This stream is already open and ready to supply input data. Typically this stream corresponds to keyboard input or another input source specified by the host environment or user. An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted. public class BufferedReaderextends ReaderRead text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. The buffer size may be specified, or the default size may be used. The default is large enough for most purposes. 此例的System.in代表键盘,可是为什么就可以作为InputStreamReader的参数,而可以在显示器上输入数据那?问一下,在运行程序时,在DOS窗口下输入的和输出的各是什么流? 字节/字符? 为什么?import java.io.*;
public class Echo{
  public static void main(String[] args) throws IOException{
    BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    String s;
    while((s=in.readLine()).length()!=0) System.out.println(s);
  }

解决方案 »

  1.   

    public static final InputStream in;
                        ============
      

  2.   

    输入 的时候能看到是 操作系统或虚拟机提供的回显吧 以前有的系统就没有回显
    那个 不是System.in 作的事情字符本身就是字节组成的 这个就像 tcp/ip 层次 中的 两个不同的层次
    不同层次概念不同但是可以指向同一组数据
    字符流 比较靠近java程序 而 字节流 比较靠近底层平台
    所以,最终你用 sm方式解释一组数据(字符流/字符流)是看你程序zm写的
    而最底层那就是binary了