Hello World in Java in Details Step By Step


Step 1. Write Java Program in any editor such as Note Pad.

Step 2. Save the program with  .java extension.

Step 3. Open command prompt.

Step 4: Compile java file by typing "javac HelloWorld.java" in command prompt.

Step 5: Run it by typing  "java HelloWorld in command prompt.


Example:

Step 1: Write Java Program in any editor such as such as Note Pad.

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




Step 2. Save the program with  .java extension.




Hello World Java Program





Step 4: Compile java file by typing "javac HelloWorld.java" in command prompt.
     
             

Compile Java Filein Command Line
                   Java compiler compile java file to class file and generate byte code


Step 5: Run it by typing  "java HelloWorld"  in command prompt.


                                           
How to run jan class file in command prompt

             Byte code translate to machine code and run on JVM.

Output is "Hello World".





1 comment:

  1. Excellent Post. Are you looking for Laptops for your training? Click here Laptop Price to select your idle Laptop in budget.

    ReplyDelete