Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Output · Lesson 16 of 28

System.out.println()

A free lesson from Swipe Coding · Java, level 2 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
Time to make Java actually say something out loud. 🔊

To display anything on the screen (the "console") in Java, you need the command System.out.println(). It outputs the text that you pass to it in parentheses and quotation marks.

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
This complete program outputs exactly one line: Hello, World!
🤖
That little "ln" is doing more work than you would guess. 📏

The "ln" in println stands for "line". After the output, the cursor automatically jumps to a new line. So the next text begins below it, not right after it.

System.out.println("First line");
System.out.println("Second line");

// Output:
// First line
// Second line
Two println() calls produce two separate lines.
Fill in the blank

System.out.println() outputs text and then automatically jumps to a new ____.

System.out is the destination of the output (the console). println is the method name. The text in parentheses and in double quotation marks is called a "String" — exactly what gets printed.

System.out.println("I am learning Java.");
System.out.println("This is fun!");

// Output:
// I am learning Java.
// This is fun!
You can write as many println() lines in a row as you like — each one produces its own line.
Quick check

What happens after System.out.println("Hi"); outputs the text?

🤖
Miss the quotation marks here and Java gets very confused. ⚠️

Important: The text that println() should output must be in double quotation marks, for example "Hello". Without quotation marks, Java would interpret the text as program code rather than plain text.

True or false

System.out.println() outputs text without any line break, just like System.out.print().

Keep your streak going in Swipe Coding

Swipe through every level of Java on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →