What is the difference between print( ) and println( ) method ?

The println("aString") method prints the string "aString" and moves the cursor to a new line. The println() method can also be used without parameters, to position the cursor on the next line
 
Difference between the methods print() and println()

public class MyMessage2 {
public static void main(String[] args) {
System.out.print("JA");
System.out.print("VA");
System.out.println();
}
}
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. Hence, subsequent printing instructions will print on the same line. The println() method can also be used without parameters, to position the cursor on the next line.
 
The println and print 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.
 
Difference between the methods print() and println() 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.
 
Back
Top