println vs print | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

println vs print

At what point do we use: System.out.print instead of System.out.println ?

2nd Aug 2016, 3:12 PM
Sidepocket
Sidepocket - avatar
3 Answers
+ 3
println() is used to print in the next line while print () is for printing in the same line. e.g. : 1. System.out.println("hello") System.out.println("world") output : hello world 2. System.out.print("hello") System.out.print("world") output : hello world
2nd Aug 2016, 6:24 PM
Sumit Tyagi
Sumit Tyagi - avatar
+ 1
print vs println print : in current line println : in new line is work like "\n"
3rd Aug 2016, 7:46 AM
Mohammad Reza Karimi
Mohammad Reza Karimi - avatar
- 6
they are both the same right but for me print is used to get user input while println is for the output
2nd Aug 2016, 4:21 PM
Senninseyi
Senninseyi - avatar