Java – Hello World

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.

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

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