+ 1
Difference between println and print methods.?
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.
+ 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. :)