To print on screen in java we can use both print and println method, which belong to PrintStream class. However, we directly cannot create the object of PrintStream class. Therefore, System.out give the PrintStream class object.
package firsthelloapplication;
public class FirstHelloapplication {
public static void main(String[] args) {
System.out.print("Hello world");
}
}
Print method displays the result and then returns the cursor in the same line next to the end of the result but println method displays the result and throws the cursor to the next line.