Tuesday, April 2, 2013

Java Hello World program

This is a very simple Hello World program. You will learn to use println() method to write the Hello World text on the screen.

HelloWorld source code:

1. public class HelloWorld
2.  {
3. public static void main(String[] args)
4. {

5.  System.out.println("Hello World");

6. }


Program Output
Hello World

Code Explanation:
1. open HelloWorld class.
2. opening bracket of the HelloWorld class.
3. start the main method body.
4. opening bracket of the main method.
5. display Hello World on the screen.
6. close the main method.
7. close the HelloWorld class.

No comments:

Post a Comment