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
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:
// HelloWorldThat 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
// CWhat 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!System.out.print() outputs text, but does not add a ____ afterward.
After System.out.print("Hi"); the next output automatically begins on a new line.
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 →