Friday 9 March 2012

A Simple Hello World Program in Java

To run a simple hello world program in java First we need to write the program in the notepad
as give below:

Step1:
Class Helloworld{
   public static void main(String args[])
   {
System.out.println("Hello World..!");
   }
}

Step2:
Save it with the file name Helloworld.java[The File name must be the name of the class].

Step 3:
Compile the program in command prompt(cmd)javac HelloWorld.java is used to compile the source code
Note:
When u compile the program it will create a byte-code file name Helloworld.class

Step 4:
Run the program in comand Prompt(cmd)
java HelloWorld
Note:
Now the byte code is excected in java interpreter with the command given above

Output of the Program :
Hello World..!

Tags:
          simple java Program,java,class,bycode,interpreter,source code,.java


No comments:

Post a Comment