我看了jdk6中System.java的源码,这么定义我们经常用的out:
public final static PrintStream out = nullPrintStream();
然后nullPrintStream()方法如下
private static PrintStream nullPrintStream() throws NullPointerException {
if (currentTimeMillis() > 0) {
    return null;
}
throw new NullPointerException();
    }整个方法跑完不是回复null就是抛Exception,那我们平时还怎么用的System.out.println(..)之类的方法?

解决方案 »

  1.   

    现在java开源了,你可以去看看真正的源码
      

  2.   

    不太明白redduke1202() 说的意思:(
      

  3.   

    自己在CSDN上找到一篇,看中。。
    http://topic.csdn.net/t/20050921/21/4285473.html
      

  4.   

    看了下,似乎是有几个native的本地方法,除非去看java的c/c++底层代码才能搞清楚
    看了c/c++代码,还得去看汇编的底层代码,机器码,cpu电路·····
      

  5.   

    看源码总得先看注释吧,你有没有看注释?
    /**
         * The following two methods exist because in, out, and err must be
         * initialized to null.  The compiler, however, cannot be permitted to
         * inline access to them, since they are later set to more sensible values
         * by initializeSystemClass().
         */