[ Steps + Video ] How To Run Java Program, Hello World Program


How To Run Java

As you know java is very important in IT programming so every IT student should know at least basics of Java Programming like how to install Java in PC and how to run simple java program.

In this article, I will explain here How to Run the Java Program using the Command Prompt.
First of all, you must need to have installed Java JDK on your computer or laptop.
To learn how to install click here

Video of how to install Java JDK



This is simple java program and save this in notepad.

class Hello {
  public static void main(String[] arguments) {
    System.out.println("Hello World");
  }
}

Note file name should be same as class name and must be save file with extension of .java
For example Hello.java  so the class name is "Hello"

Now open command prompt by
Click on start button and type cmd in search and press enter key.

Locate the java file, in the video, i have saved java program file on the desktop in one folder called Program so you may follow the same.

Now compile the java program by
Javac Hello.java

The new class file will get created automatically it means you have successfully compiled the java file.

Now the last step is Run the java program by command java Hello

Read: How To Install Java and Set Path in Your PC or Laptop

You can see my below video for reference.



Please comment below if you have any problem.

Bhavesh Desai Software QA Engineer

Bhavesh Desai is an Software QA Engineer and he do blogging in freetime

No comments:

Post a Comment