Display "Hello World!!!" on console

In this tutorial we have print "Hello World!!!" on console. This is very simple Java program. The steps to write and run first Java program are:
  1. Open Notepad and paste the following code in it.
    class HelloWorld {
     public static void main(String args[]) {
      System.out.println("Hello World!");
  2. Save the above file as "HelloWorld.java" in some directory. As an example I have saved it in directory "C:\JavaPrograms"Note that the filename must be same as the classname containing the main method.
  3. Open Command Prompt and go to the directory where you have saved the program.
  4. To compile the Java program use the following command "javac HelloWorld.java".
  5. Finally to execute the program use the command "java HelloWorld". Then you will get the following output

The following snapshots gives you the detailed view of the first program