System.out.println()
Try it yourself →Writes the value and moves to the next line.
Syntax
System.out.println(value)
Description
The main way of output in Java. There is also print (does not add a newline) and printf (formatted).
Example
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}Expected output
Hello World
When to use?
Showing results, debugging.
Common mistakes
- ⚠️ Every statement ends with a semicolon (;).