System.out
is declared as public static final PrintStream out
.
But you can call System.setOut()
to reassign it.
Huh? How is this possible if it's final
?
(same point applies to System.in
and System.err
)
And more importantly, if you can mutate the public static final fields, what does this mean as far as the guarantees (if any) that final
gives you? (I never realized nor expected System.in/out/err behaved as final
variables)
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…