I have searched the JDK many times, but I can’t find where the out field is initialized
such as
public static final InputStream in = null;
public static final PrintStream out = null;
public static final PrintStream err = null;
So when are these static fields in the System class initialized?
>Solution :
In openjdk-11 java.lang.System on line 1968
setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")));
which is in private static void initPhase1() and that is documented to
Initialize the system class. Called after thread initialization.