Java

Write and Execute First Java Program in NetBeans3 min read

Note: In this Simple Java Tutorial we will assume that you have already downloaded and installed Java Development Kit JDK and Net Beans 8.1 IDE or higher.

Short Steps:

Step 1: Start Net Beans IDE
Step 2: Now you will Click on File menu in Net Beans IDE and select New Project
Step 3: In the next step, click on Java from ‘Categories’ and select ‘Java Application’ from ‘projects’.
Step 4: Type ‘HelloWorld’ in the Project Name text box. Afterwards, Click on ‘Finish’.
Step 5: Write the following statement to display ‘Hello World’
System.out.println(“Hello World”);
Step 6: At the end, you will click on the Run Menu and select the Run Project (HelloWorld).




Hence, if there are no errors then you will see the following output: Hello World

Steps With Pictures To Write and Execute First Java Program in NetBeans

Start NetBeans IDE 8.1 or higher

Step 1:
First of all, Start Net Beans IDE

Click on File -> New Project

Step 2:

In the second step, you will click on File menu in the Net Beans IDE and select the ‘New Project’ option.

Selecting Java from “Categories” and select Java Application from “projects”

Step 3:

The IDE will show a ‘New Project’ dialog box. Select Java from ‘Categories’ and select ‘Java Application’ from ‘projects’. Click on ‘Next’ button.

Step 4: Type Name of Java Project and Select Project Location

Type ‘HelloWorld’ in the Project Name text box.

Note: You should Capitalize first letter of each word. This is due to Java Naming Conventions. A class name will have first letter as capital letter for each word.

Click on ‘Finish’.

Step 5:

Write the following statement to display ‘Hello World’

Write this code inside main() method.

Step 6 – Click on Run Project from Run menu

Then you will click on Run Menu and select Run Project (HelloWorld)

If there are no errors then you will see the following output:

Congratulations: You have written your first Java Program. This is the most basic and popular “Hello World” printing program. You can Run the program from the Run menu and view the following output of this Java Program in output pane..

Leave a Comment