Tutorial :Java beginner question: System.out.println


I am just beginning to learn Java, coming from C background.

How can the line "System.out.println()" be dissected?


Java is an object-oriented language.

System is a class that contains useful fields and methods. See the API.

out refers to an object that is part of System that is the standard output, so it written as System.out.

println("blah") is a method for System.out that prints a String as a line. When no argument is given (so println()) it prints a blank line.


System is a class made available by Java to let you manipulate various operating system related objects. It's part of java.lang namespace.

out, being one of those objects, is a static publicly available object inside that class. The object itself, representing standard output, is an instance of java.io.PrintStream class. Standard output is, on most operating systems, console output.

println is a method of java.io.PrintStream class that lets you output some text into the stream and, as opposed to print() method, gets you to the new line after the text.

From here

PS: check google :)


It's the same as:

cout << "\n";  


System contains a number of class fields and methods including

  • err
  • in
  • out

out is of type PrintStream and refers to the standard output stream to which data can be written - this is essentially the display, but it can also be another device.

PrintStream contains a static method called println that allows data to be written. It appends a line separator string at the end of the data you attempt to write.

The static keyword essentially means that it belongs to the class rather than the instance.

So when you see:

System.out.println("Hello World");  

It's writing the characters Hello World plus a line separator to the out stream which is connected to the Console.

For more information see:



You are advised to consult the java.lang.System.out doc.

public static final PrintStream out

The "standard" output stream. This stream is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user.

For simple stand-alone Java applications, a typical way to write a line of output data is: System.out.println(data)

and java.io.PrintStream.println() :

public void println()

Terminates the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').


It's basically like puts in C -- take a string and emit it on standard output.


System.out is a reference to the programs stdout. println works like it does in C. In your example passing no argument will simply return a newline.

Unlike C, Java is object oriented, so methods/functions and attributes/variables are bundled into objects such as "System". Take a look at the javadoc to see what else is available on the System object.


The dot "." operator is used to specify a member (function) or variable internal to a class or object.

It is used in a similar fashion to the member selection operator "->" in C.

What "System.out.println()" is saying is:

Look in the System class for the out member, then look in the out member for the println function and run the println function.






System is a class which means that it's a blueprint, but a blueprint of what? According to the API,

The System class contains several useful class fields and methods.

Now, System has several properties or fields such as:

  • err - The "standard" error output stream.
  • in - The "standard" input stream.
  • out - The "standard" output stream.

The API also tells us what out is. Out is actually another object, specifically, a PrintStream object.

Again by consulting the API, we will see that out, being a PrintStream object, it also has several properties as well as actions or methods associated with it.

Println is one of out's methods. What it does is it displays a string, or a number or what have you in the "standard output" or simply, your screen.


System.out.Println() is same as printf("\n");

System allows you to do various operations related to your operating system and "." is used to access the member functions and Println will print the data in a new line



System is the class for the standard input and output streams while out is the object of the class. So we write it as System.out.

and println() is the method that is used to print the string as line.


System is a class which has a static variable out of type PrintStream and println is a method in the PrintStream class.


Like David Johnstone said : System is a class the java has that has useful methods out is a type of PrintStream print , println , printf are different ways you can output something to the console;

System.out.print("your text here"); prints "your text here".    System.out.println("your text here"); prints "your text here" and goes to the next line    System.out.printf("%s %s %s" , string1,string2,string3); prints out the contents of string1 string 2 and string3. The %s tells java to put the associated string in place of it.  

Hope this helps.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »