顺便问一下System.err.println((char)ch);输出和用System.out.println((char)ch)输出有什么区别呢?

解决方案 »

  1.   

    The "standard" error output stream. This stream is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored. err:Class PrintStream
      

  2.   

    1.基本问题,自己想吧。
    2.System.err.println错误信息输出(当然也能够输出其它信息);System.out.println调试信息(包括错误信息)输出。前者处理能力优先于后者。在自己的环境中可以对它们进行适当处理。
      

  3.   

    一般来说,我们习惯在程序中打印一些信息,让自己知道是否正常运行,这时多用OUT
    而在程序出错的地方,我们有时使用ERR来打印出错信息
    通过setOut(PrintStream out)和setErr(PrintStream err)我们可以把这两类信息分别写入不同的流(如两个文件),这样便于查看和处理当然你也可以不用ERR,事实上我就很少用