.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.
Learn Java on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Java
Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.Beginner Friendly17 hours