Understanding Java’s Everyday System.out.println();

You used it for “Hello World”, but do you understand its true meaning?

Blake Sanie
2 min readNov 29, 2020

System.out.println(), or S.O.P, is Java’s most commonly used printing function.

Let’s break it down further using our understanding of the language and more general OOP concepts.

1. System

System is a class located in the java.lang.System package.

Though it cannot be instantiated directly due to its private constructor, it houses capabilities regarding standard IO, error streams, environment, the filesystem, and more.

2. out

out is a static field of the System class.

Note that its static nature means it can be accessed without instantiating System, just like Math.PI.

out is of type PrintStream, allowing it to output data to the “standard” output stream at any point. In most cases, this occurs in the form of displaying text in the environment’s command prompt.

3. printLn()

printLn() is a void method that outputs its parameter to the output stream, as previously described.

In typical Java fashion, printLn() is overloaded to accept multiple types, such as String, boolean, char, int, long, double, Object, etc.

A similar function, print(), belongs to the Out field that accomplishes the same purpose, but does not append the newline (‘\n’) character to the output stream.

It’s all OOP

Interesting… diving deeper into one of Java’s most fundamental functions leads us to encounter several core concepts of Object Oriented Programming (OOP): Constructors, Visibility Modifiers, Static Fields, Overloading, and even more not mentioned here.

I challenge you to critically inspect your favorite language, finding how its design and architecture is showcased within code segments that are taken for granted.

--

--

Blake Sanie

‌‌‎Inquisitive student.‎‌‌ Aspiring engineer. Photography enthusiast. Curious stock trader. blakesanie.com