Reputation: 2142
How is the System class structured/designed with regard to the standard in-/output?
The System class has a public final out
method that returns a PrintStream
. Is the println()
method then a nested method or how does that exactly work if I call System.out.println();
?
Upvotes: 0
Views: 85
Reputation: 89189
out
is a public static final
variable, and since it's static, one can get out
as System.out
(i.e. in a static manner).
out
is a PrintStream
which contains the println()
method, and you're accessing the println()
method from the PrintStream
(i.e., from out
).
Upvotes: 3