Java Hello World Program

Your Journey for being a java programmer starts here. This is your first program and first program is very important to everyone, so will guide you step by step to run your first program.

Assuming that you have already installed JDK and JRE in your system and setup the environment variable, you will need a java code editor. The editor that we are going to use is Spring tool Suite (STS) which is more advanced than eclipse and widely used by real time projects. But, it is recommended to use notepad in at least 1st 10 programs.

Open STS and click on File>new>project. In the search wizard type java and select java project. Then click on next button. Give the project any name > My Java Projects and then click on finish button. In the left hand side, under package explorer tab, you will get My Java Projects. Expand the project and then right click on src > new >class. Under name, give the name of the class as HelloWorld and then click on finish button.

This will open a file HelloWorld.java in the editor. Edit the content as given below, we will see each aspect of this program in some time. For now you just type this program and save it.

// Your First Program

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

Leave a Reply