Task: How To Write and Execute First Java Program in NetBeans IDE.
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.
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’
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
First of all, Start Net Beans IDE
Click on File -> New Project
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”
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 No:5 Edit and Write Code in Default Java Program Template
Write the following statement to display ‘Hello World’
Save changes to project by File -> Save.
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..
After writing and executing this Java program, now you should be able to write a Java Program in NetBeans Java IDE to display Your Name. Try it, now.
You can also read a simple Java Program To Input a Number and Display Its Square
2,071 total views, 11 views today