1 2 3 4 5 6 | public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } |
Above program is example of how to print hello world in Java.
To print out, java print method is used.
System.out.println("Hello World!");
println will print the string “Hello World” together with a new line.