I was going through the internal implementation of System.out.println()
.Though I understood how this is working but couldn't figure out :
- Why they decided to use the
System
class in the first place. They could have directly used
PrintStream
class which is present in theio
package.What is the significance of the syntax
className.referenceVariable.Methodname
, since we generally don't use this. Is there any specific reason for this.
Can anybody elaborate on these points or any related information would be great.
System.out
stuff was first done before Java 1.0. In hindsight it was probably a mistake. – ScreamclassName.referenceVariable.Methodname
syntax. – PamilapammiSystem
in a similar way environment variables are. – GlaudiaPrintStream
s care about the system's standard IO streams? There arePrintStreams
which operate on completely different data sinks (generic OutputStreams for example.) – Canoness