Learn How To Make A Hello World Java Program Using Netbeans IDE

Java is a pure object oriented programming language. Java is not much difficult to learn, but what you will require is passion for learning it. This tutorial is for the people who have just started to learn Java so the people who are not interested might leave.

I’ve presumed that you have already installed JDK and NetBeans IDE in the machine where you are developing.

Now follow the steps given below to make your First Hello world program using Java programming language.


Click on the File located on the menu bar and Hit on New Project or Press Ctrl+Shift+N to make a new Java Project.

NetBeans IDE New Project

On clicking on New Project, You will see that a pop-up window appears as shown in the below Image. Click on Java in the Categories section and then select Java Application in Projects section in that frame and proceed further by Clicking on Next Button.

As you click on the Next button of the New Project Window, You will be asked to enter the name of your project and you will be asked to enter the location of the project. You will see something as shown in the below Image. Enter the desired name of your project and Set the location and click on Finish button.

Now you have successfully added a project in the NetBeans IDE. You will see the name of your Project in the Projects Section, Now Right click on any of the folder of your project and click on New and click on New jFrame. See the below Image to get clear about how to do.

As soon as new click on the jFrame Form you will see a window in which you will be asked to Enter the name of the class which will also be the name of the Frame. Enter the name and click on Finish Button. The window will be as the below Image.

As soon as you click on Finish Button you will see that a blank design window appears in the IDE. A design window is a window in an IDE where you can design your Form. As NetBeans provide a Graphical User Interface you will be able to drag controls such as label, Button, Fields etc. in the design window. The screenshot of the blank design window will be like the below image.


Now click on the Label which is located under the Swing Controls in the palette and drag it to the design window, By default you will see that the name of the control jLabel will be jLabel1 to edit its name you will have to drop it and Right click on it and press Edit text on it. See the below image to you will get an Idea about how to do it.

make a java program of hello world in 4 steps

Now add a button located beneath the Swing Controls in Palette as you added a label in your Design and even rename it as explained in the above paragraph. That’s it designing of your Simple application is complete. But only designing won’t give you Result.


Now comes the central part of this post, That is coding the Application you made, To code the Application you have to double click on the control which you will be coding, Here I’m writing a code in the Button, as I want to show an output on click of the button. So double click the Button and you will see the code which was already generated by the IDE for the designing you did. On double clicking the button you will directly taken to the place where you will have to do coding for the button control. You will see

Private void jButton1ActionPerformed(java.sqt.event.ActionEvent evt) below this you type
System.out.print(“Hello world”);

System.out.print("Hello world");


Now you have designed the Application as well as coded the Application, Now its time to run your App. Click on Shift+f6. You will see that your Application opens in a window as shown below and as soon as you will click on the Button you placed in your Application you will see that the Hello World gets printed in Output window.

Please follow and like us:

Your email address will not be published. Required fields are marked *

Contact CPD Technologies