When looking into the implementation of the java.lang.System
class, I find this:
public final static PrintStream out = null;
From that definition alone, I can tell that the value of System.out
will always be null
. However, it is initialized when the program starts (with the System.initializeSystemClass()
method auto-invoked by the JVM), and I can change its value using System.setOut
, which performs a security check, then delegates the call to the setOut0
method which is a native
method that changes the value of System.out
.
Why is it that I can change the value of System.out
even though it is declared final
?