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.
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 No:5 Edit and Write Code in Default Java Program Template
Step 5:
Write the following statement to display ‘Hello World’
System.out.println(“Hello World”);
Save changes to project by File -> Save.
Step 6 – Click on Run Project from Run menu
Step 6:
Then you will click on Run Menu and select Run Project (HelloWorld)
If there are no errors then you will see the following output:
/* * How to write and execute your first Java program in NetBeans IDE under Windows OS. */ package helloworld; /** * @author www.EasyCodeBook.com */ public class HelloWorld { public static void main(String[] args) { // TODO code application logic here System.out.println("Hello World"); } }
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..
Hello World
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
Pingback: Download and Install Java JDK and NetBeans IDE | EasyCodeBook.com
Bookmarked!, I really like your blog!
thank you
it’s worked
I really happied