What is 'System', 'out', 'println' in System.out.println()?
System.out.println() is one of the most number of times compiled statement in the Java. We shortly call it SOP.
System.out.println is a Java statement that prints the passed argument in it, on the standard output device such as Console.
- System – is a final class in java.lang package. System class provides standard input, standard output, and error output streams; access to externally defined system properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.
- out – is a static member field of System class and is of type PrintStream. Its access specifiers are public final. This gets instantiated during startup and gets mapped with standard output console of the host machine. This stream is open by itself immediately after its instantiation and ready to accept data.
- println – is a method of PrintStream class. It prints the argument passed to the standard console and a newline. There are multiple println methods with different arguments (overloading). Every println makes a call to print method and adds a newline. print calls write() method for further processing of datat which need to be print.
Structure of System.out.println
Below is the basic class diagram of System.out.println in the JDK source.
Read Types of Cursor in Java Programming Language