Why does the nullPrintStream() function in java/lang/System compare currentTimeMillis() to zero?

StackOverflow https://stackoverflow.com/questions/8914685

  •  29-10-2019
  •  | 
  •  

문제

When loading the System class, the <clinit> method instantiates the in, out and err PrintStream variables to null using the nullPrintStream() method:

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

I understand why this is the case, and why the variables cannot be instantiated during loading, but what I'm confused about is the content of that method.

Why is it comparing currentTimeMillis() to 0? In what case would that comparison ever return false?

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top