Java Program to print Hello World

In this program let us create a simple "Hello World" program to print the string "Hello World" on the console.

Program

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!!!");
    }
}

Let us understand the program by breaking into simple parts:

  1. public class HelloWorld: Any Java program starts with a class, in this case the class name is HelloWorld
  2. public static void main(String[] args): main is the entry point for any Java program.
  3. System.out.println("Hello, World!");: System.out.println prints the string mentioned in double-quotes (").

Output

Hello World!!!