+ 4

what is difference between these syntax in java: System.out.print("*"); and System.out.println("*");

tell the difference between these syntax in java: System.out.print("*"); and System.out.println("*");

14th Sep 2017, 4:46 AM
Prathamesh Dhuri
Prathamesh Dhuri - avatar
5 Answers
+ 9
//in actual no difference will be there in the output of the code if u use only 1 print statement //but when u print multiple lines using these u will see the difference in the output by ur own //1) System.out.print("*"); System.out.print("*"); //output ** //2) System.out.println ("*");System.out.println("*"); //output * *
14th Sep 2017, 5:05 AM
Changed
Changed - avatar
+ 3
System.out.print will not print a new line after it is called. System.out.println will print a new line. System.out.print("*"); System.out.print("_");// prints *_ System.out.println("*"); System.out.println("_"); // prints * // _
14th Sep 2017, 4:54 AM
Zeke Williams
Zeke Williams - avatar
+ 2
println = Print and include a line break (enter) print = print and keep the cursor on the same line
14th Sep 2017, 4:47 PM
Xeroxis Labz
Xeroxis Labz - avatar
+ 2
thanks @ Gaurav ,Zeke, Xeroxis, Amrit Mahendra.
22nd Sep 2017, 3:59 AM
Prathamesh Dhuri
Prathamesh Dhuri - avatar
+ 1
System.out.print() does not break the line. System.out.println() breaks the line.
14th Sep 2017, 9:25 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar