Return to site

☕🎓JAVA CERTIFICATION QUESTION: System.out.println()

· java,ocp

Which class's `println` method do we invoke when we use `System.out.println()`?

* PrintStream

* PrintWriter

* BufferedOutputStream

* FileWriter

* OutputStreamWriter

#java #certificationquestion #ocp

When we invoke the `System.out.println()` method, we are essentially calling the `println` method of the `PrintStream` class.

The `System.out` object is an instance of the `PrintStream` class in Java, and it provides various methods for printing data to the standard output stream.

The `println` method is one of these methods, and it is used to print a line of text and then terminate the line with a newline character, resulting in a new line in the output.

So, the correct option is:

* PrintStream

out👉https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#out

PrintStream👉https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html