.println()
Published Jun 25, 2022Updated Nov 5, 2022
Contribute to Docs
The .println()
method prints its argument to the console followed by a new line. It is probably the most common method of displaying output to the console.
Syntax
System.out.println(argument);
The argument
will be displayed on the console, followed by a new line.
Example
The following example prints some content to the console.
public class PrintExample {public static void main(String[] args) {System.out.println("Output");System.out.println(123.456);System.out.println(true);}}
This results in the output:
Output123.456true
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.