关于System类中out属性 实例化的问题

    System类中out属性的声明是这样的:

    public final static PrintStream out = nullPrintStream();

private static PrintStream nullPrintStream() throws NullPointerException {
if (currentTimeMillis() > 0) {
return null;
}
throw new NullPointerException();
}

问题:out并没有实例化为什么 可以 调用 PrintStream中的方法?

    原来答案在 这个方法里面:initializeSystemClass.

    这是一个用来 初始化类中静态属性的方法,至于什么 时候 初始化 ,可能是虚拟机加载 的时候 吧

    

原文地址:https://www.cnblogs.com/ZSG-DoBestMe/p/5201630.html