This is simple Hello World! java program. In this tutorial you will get a simple java program to print “Hello World!” on console.

Let’s create a file and add following code.

Compile java program using javac command.

$ javac

After compilation, it will create a HelloWorld.class file. Now use following command to run program.

$ java HelloWorld

Hello World