+ 1

Difference between println and print methods.?

22nd Mar 2016, 10:49 AM
Shubhi Agarwal
Shubhi Agarwal - avatar
2 Respuestas
+ 3
Both methods are used to print data on console, the only difference between above two methods is 'System.out.println' prints data and place the cursor in next line. So the next coming output prints in the next line whereas 'System.out.print' prints data and place the cursor in the same line. So the next coming output prints in the same line.
8th Apr 2016, 2:56 PM
Shobhit Jain
Shobhit Jain - avatar
+ 1
Println(): Prints code after this statement, under this statement. Ex: System.out.println("Cats are cool."); System.out.println("Coffee is much cooler. Pun intended."); //Output: //Cats are cool. //Coffee is much cooler. Pun intended. Print (): Prints code after this statement next to it. Ex. System.out.print("Awesomeness is "); System.out.println("pizza."); System.out.print("Okay? Okay.); //Output: //Awesomeness is pizza. //Okay? Okay. Sorry for being super cheesy (again with the puns lol), but I hope you get the idea. :)
24th Jun 2016, 12:58 AM
Scylla
Scylla - avatar