Core JavaJava Interview Questions

System.out.println explained

Posted On
Posted By admin

In this blog post, I will be explaining the System.out.println statement which is the first statement you will come across when you start learning Java programming.

 

System

System is a final class in the java.lang package. It has several useful classes and methods. In addition to supporting standard input and output, it has methods to access external properties, method for initiating garbage collection, etc.  It supports input/output by providing static variables corresponding to the input/output streams.

 

Out

Out is a static variable in the System class. It is of the type PrintStream.  Since it is a static variable, it is instantiated at start up. It is mapped to the standard output which is the console. This stream is already open and ready to accept output data.

 

Println

Println is a method within the PrintStream class.  There are several overloaded versions of this method that accepts different types of data like String, integer, double, etc.  Each method prints the data passed to it and also adds new line.

If you'd like to watch a detailed video tutorial of this topic or other related topics, do check out my Java course here

Also, if you'd like to test your Java knowledge, do check out my practice tests course here


If you like this post, please do let me know via the comments box below.  You can also connect with me via my Facebook Page or subscribe to my Youtube channel!

Related Post

leave a Comment