我知道那是System类中的一个字段,它引用PrintStream的某个对象作为print(System.out.getClass());
返回类java.io.PrintStream。
我也认为系统类中的声明应该像 public static PrintStream out;
我在这里的查询实际上是系统类中“ out”字段的值。
它不能像
public static PrintStream out = new PrintStream(System.out);
只是好奇
当您检查System
类的源代码时,您可以看到它是通过本机方法调用设置的:
private static native void setOut0(PrintStream out);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句