Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Output · Lesson 17 of 28

System.out.print()

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

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

🤖
print() is println()'s more low-key sibling — no automatic new line. 🔇

Besides println(), there is also System.out.print(). It works almost the same way, but with one important difference: print() does NOT jump to a new line at the end.

System.out.print("Hello");
System.out.print("World");

// Output:
// HelloWorld
Both texts end up right next to each other on the same line — with no space and no line break in between.
🤖
The cursor just... stays put. That is the whole trick. 📍

That is the key difference from println(): after print(), the cursor stays exactly where the text ends. The next output is appended directly after it.

System.out.print("A");
System.out.println("B");
System.out.print("C");

// Output:
// AB
// C
"A" is printed without a line break, immediately followed by "B" via println() — which only then produces the line break. "C" therefore begins on a new line.
Quick check

What does this code output?

System.out.print("X");
System.out.println("Y");
System.out.print("Z");

print() is handy when you want to build up an output piece by piece from multiple commands, but have it look like a single line at the end. Remember: you have to add spaces yourself — print() does not do that automatically.

System.out.print("Java ");
System.out.print("is ");
System.out.print("fun!");

// Output:
// Java is fun!
The spaces here are deliberately placed at the end of "Java " and "is " — otherwise the words would run together.
Fill in the blank

System.out.print() outputs text, but does not add a ____ afterward.

True or false

After System.out.print("Hi"); the next output automatically begins on a new line.

Quick check

What is the main difference between System.out.print() and System.out.println()?

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 →