strange 'out' variable, System.out.println()

后端 未结 3 1851
再見小時候
再見小時候 2020-12-11 06:18

Following is the code from java.lang.System class (JDK version 1.6)

public final static PrintStream out = nullPrintStream(); //out is set to \'null\'

priva         


        
3条回答
  •  萌比男神i
    2020-12-11 06:46

    System.in, out, and err are managed by the JVM from native code. This whole magic with nullPrintStream() was there to keep javac from inlining these fields. Since java 7 it looks like

    public final static PrintStream out = null;
    

提交回复
热议问题