What's the meaning of System.out.println in Java?

No. Actually out is a static member in the System class (not as in .NET), being an instance of PrintStream. And println is a normal (overloaded) method of the PrintStream class.

See http://download.oracle.com/javase/6/docs/api/java/lang/System.html#out.

Actually, if out/err/in were classes, they would be named with capital character (Out/Err/In) due to the naming convention (ignoring grammar).


System is a class, that has a public static field out. So it's more like

class System 
{
    public static PrintStream out;
}

class PrintStream
{
    public void println ...
}

This is a slight oversimplification, as the PrintStream class is actually in the java.io package, but it's good enough to show the relationship of stuff.


System.out.println()

High level Understanding

For understanding this we need to recall few basics of java:

  • dot (.) operator in java: In java . (dot operator) is used only to call methods or variables. So we can say out is either method or variable.
  • Methods in java : we know methods always have parenthesis ‘( )’ after method name, So out cannot be a method in java. So out its a variable and println() is a method.
  • Class name in java: Class name should start with Capital letter ideally in java, So System is a class.

Now with basic knowledge of java we know :

  • System is a Class
  • out is a Variable
  • println() is a method

Lets get more in details:

out variable: static or instance?

  • called using class name, so we know its static variable of System class.

  • but its calling a method println() method so ‘out’ is an object of the reference type PrintStream.

the System class belongs to java.lang package

class System {
  public static final PrintStream out;
  //...
}

the Prinstream class belongs to java.io package

class PrintStream{
public void println();
//...
}