JAVA Syllabus
QUESTIONS & ANSWERS

Explain each in "System.out.println()"?

In Java, System.out.println() is a method that prints a line of output to the standard output stream. Here's a breakdown of each part of the method:

  • System is a pre-defined class in Java that provides access to the system resources, including standard input, output, and error streams.

  • out is a static member of the System class that represents the standard output stream, which is used to print output to the console.

  • println() is a method of the PrintStream class that is used to print a line of output to the standard output stream. It prints the specified string followed by a line separator, which is typically a newline character (\n).

So, when we call System.out.println("Hello, world!"), we are printing the string "Hello, world!" to the standard output stream, followed by a line separator. The output of this code would be:

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

Output:

Hello, 
World!
06/03/2023, 10:27 am Read : 215 times