Hello World Program of Java

Hello world Program of Java

Hello world program of java is the basic program to print “Hello World” message on the console. Here you will get and learn the program code to print Hello World in Java.

How to run Java program?

Follow the following steps  to run the first program in java.

1. Install the Java Development Environment:

  • It is must that you should have  Java Development Kit (JDK) installed in your system to run a java program. You can down it in free from its official website.

2. Set Up Your Development Environment:

  • Install and setup the Integrated Development Environment(IDE) of code editor for java like Eclipse, BlueJ, Xcode.

3. Open new file and Write code:

  • Open new file, write the following code, and save the file with ‘.java’ extension.

Hello world program of java

4. Compile the Java Code:

  • Open command prompt and move to the directory where your java program file is located using ‘cd’ command.
  • Compile java program using following command

              javac HelloWorld.java

  • If the program runs successfully without any error the ‘HelloWorld.class’ file will be generated.

5. Run the Java Code:

  • To run the java program code and get output, type the following command on the command prompt.

            java HelloWorld

 

Sample Compile and Run Window

Hello World Program of Java

 

 

Check out our other Java Programming Examples

 

 

Leave a Comment

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

Scroll to Top