Make first JAVA Program for the beginners

Here in this post , we will make the first JAVA program using Eclipse IDE that is actually for the beginner level. Now we have installed the eclipse in our system with the help of Complete guide of how to install the Eclipse IDE .

Lets start with our very first program of JAVA.

1) Just open the eclipse by clicking on Eclipse.exe .

Java-Program

2) Click on the “ File ” Tab –> Go to “New ” –> Click on  ” JAVA Project ” .

Java-First-Program-9

3) Enter the name of the Project lets say ” FirstJavaProgram “.

Java-Program

4) Click on Next and then Finish .

Java-Program

5 ) Now the below screen will appear and Right click on “src” folder and go to ” new ” then click on ” Class “.

Java-Program

6 ) Now a Pop up screen appear like below and Enter the name of your class “FirstJavaProgram” and tick the check box ” Public Static Void Main ”  as shown below so that main method will by default create in our class , we don’t need to write the main method in our class.

Java-Program

 

7 ) Click on Finish button.

8 ) Write the code to print My First Java Program . Just add line System.out.println(“My First JAVA Program”); inside the main method and execute the code .


JAVA code to print ” My First JAVA Program”

public class FirstJavaProgram {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("My First JAVA Program");

	}

}


How to Run the JAVA program in Eclipse IDE

Now we will learn how to run the JAVA program in eclipse IDE , we can run via many methods

1) Go to the below highlighted icon and click on that -> Go to “Run As” –> Go “Java Application” and click on that .

Java Program

2) Second way to run the program is Right click anywhere in your program code and Go to “Run As” then Go “Java Application” and click on that .

Java-Program

A prompt box will appear and click on “ok”.

Java-Program

You can see the “My First JAVA Program” in the console tab like in below screen shot.

Java-Program

Now you can run any Java program .

If you face any issue regarding this please mention in the comments below.

You can subscribe to our mobile notification or newsletter for the latest posts notifications.

 

Leave a Comment

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