How To Run My First Program In Java – Quick Tips

how-to-run-my-first-program-in-java

Once all the Java setup has been completed like installation and setting up the environment then after you are able to execute your first java program

If you did not set up java in your machine then Read This Article  HOW TO INSTALL AND CONFIGURE JAVA IN WINDOWS

Now let us start tutorial on how to create and run your first java program.

STEP-1: Create a file with extension “.java” in any system folder like “C:”, “D:” etc {MyFirstJavaP.java} through Notepad/Notepadd++

STEP-2: Now write below code in to the file:

class MyFirstJavaP{
public static void main(String[] args)
{
System.out.println(“My First Program”);
}
}

Class name must be same as file name.

Note: We will discuss more the above main method in further tutorials

STEP-3: Now open command prompt and access the folder where your java program stored

how-to-run-my-first-program-in-java

And Enter this command “Javac filename.java”

how-to-run-my-first-program-in-java

STEP-4: Now run this command to execute the java program and gives output of the program “Java class name” and your program will execute and shows the output message as well, below is the snapshot

how-to-run-my-first-program-in-java

Read Also: How-To-Install-And-Configure-Java-In-Windows

If you have any doubt/questions connect me on trainer@testingclass.com or call at +91 8860490157

REGISTER FOR SELENIUM OLINE TRAINING FROM YOUR HOME @WEEKEND

Adil

My Name is Mohammad Adil and I am a tech enthusiastic, a technical blogger, motivational speaker, trainer and passionate quality analyst with over 5+ years of experience in software testing field as well as information technology field. I worked with various reputed CMM level companies and currently working with a well-reputed product development company.