+ 1

Hi.What's the difference between System.out.print() and System.out.println() ?

7th Oct 2017, 9:05 AM
Kourosh Sajjadi
Kourosh Sajjadi - avatar
6 Answers
+ 11
1) System.out.print ("a"); System.out.print("b"); //output ::: ab 2) System.out.println("a"); System.out.println("b"); //output ::: a b 3)System.out.print("a"); System.out.println("b"); //output ::: a b 4)System.out.println("a"); System.out.print("b"); //output ::: a b 5)System.out.print("a" + "\n" + "b"); //output ::: a b //hope it helps ā˜ŗ
7th Oct 2017, 10:21 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
TheĀ println() method, after being called, prints the required text as the output and moves the cursor to a new line. The print() method insteadĀ printsĀ just the text but does not move the cursor to a new line.
7th Oct 2017, 9:10 AM
Dev
Dev - avatar
+ 9
TheĀ println("...")Ā method prints the stringĀ "..."Ā and moves the cursor to a new line. TheĀ print("...")Ā method instead prints just the stringĀ "...", but does not move the cursor to a new line.
7th Oct 2017, 9:09 AM
IMRAN SHAIKH
IMRAN SHAIKH - avatar
+ 6
println ______\n print________
7th Oct 2017, 10:10 AM
D_Stark
D_Stark - avatar
+ 1
Thank you all
7th Oct 2017, 9:17 AM
Kourosh Sajjadi
Kourosh Sajjadi - avatar