java/lang/systemのnullprintStream()機能がcurrentTimemillis()をゼロと比較するのはなぜですか?

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

  •  29-10-2019
  •  | 
  •  

質問

システムクラスをロードするとき、 <clinit> メソッドはインスタンス化されます in, outerr PrintStream 変数へ null を使用して nullPrintStream() 方法:

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

なぜこれが事実であるのか、そしてなぜ変数をロード中にインスタンス化できないのかを理解していますが、私が混乱しているのはその方法の内容です。

なぜ比較しているのですか currentTimeMillis()0?その場合、その比較はこれまでに戻るでしょう false?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top