0

What is the difference btw System.out.println() and System.out.print()

11th Nov 2016, 12:06 PM
Chris O Junior
Chris O Junior - avatar
3 Answers
+ 7
println adds a \n at the end of the output causing a new line in the output print will stay on the same position, so the next print command will continue from there
11th Nov 2016, 12:13 PM
Burey
Burey - avatar
+ 1
System.out.println("Hi friend"); System.out.print("Hi "); System.out.println(",how are you ?"); System.out.print("i'm fine \nthanks!"); output : __________________ Hi friend | Hi ,how are you ? | i'm fine | thanks! | _________________________
23rd Nov 2016, 2:03 AM
Mohammed Fakham
Mohammed Fakham - avatar
+ 1
"Println" prints on a new line. "Print" prints on the same line.
23rd Dec 2016, 9:30 PM
Tim