Problem:
Display "Hello World!" on the screen.
Code:
1 2 3 4 5 6 7 8 9 10 | /* * @author Hafiz Muhammad Umer */ public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } |
Hello World!
This program illustrates the basic program structure in java.
- The lines 1 to 3 are comments.They have no effect on the execution of the program. The are also not necessary.
- The line 4 declares a class which ends at line 10.
- At line 6 the main method starts which ends at line 9. The execution of a java program starts from the main method.
- The statement at line 8 is used to display the output. It prints "Hello World!" to the screen.
This was our first program in java and first post on "Java with Umer". Hope you liked it.
0 Comments
Thanks for leaving a comment. I will try to reply you soon.