System.out.print

System.out.print is used for printing argument without adding a new line.

System.out.print

The difference between System.out.print and System.out.println is System.out.print does not create a newline after printing its argument.

Example 1: See why the output is a single line in the code below

System.out.print("H");
System.out.print("e");
System.out.print("l");
System.out.print("l");
System.out.print("o");
System.out.print(" ");
System.out.print("V");
System.out.print("i");
System.out.print("t");
System.out.print("a");
System.out.print("d");
System.out.print("e");
System.out.print("m");
System.out.print("y");
//Hello Vitademy

 

Example 2: create a newline at the end of the word

System.out.print("H");
System.out.print("e");
System.out.print("l");
System.out.print("l");
System.out.print("o");
System.out.print("\n");
System.out.print("V");
System.out.print("i");
System.out.print("t");
System.out.print("a");
System.out.print("d");
System.out.print("e");
System.out.print("m");
System.out.print("y");
//Hello
//Vitademy