Out of curiosity, I looked at the source code for some Java API classes found at docjar.com . I saw the java.lang.System class and saw that PrintStream "out" (that is, System.out) has the following code:
public final static PrintStream out = null;
and in the comments:
The "standard" output stream. This stream is already open and ready to accept output data.
My assignment: I know that final variables cannot be changed, so why is this so when declared? Why doesn't Java throw a NullPointerException when calling a method for "out"? The same goes for System.in.
Thanks for any clarification.
source share