- class JavaDemo{
- public static void main(String Args[])
- {
- System.out.println("HelloWorld!");
- }
- }
- Line1: Every java program starts with class keyword and followed by user defined class names
- Line2:
* public: The method can be accessed outside the class / package
* static: You need not have an instance of the class to access the method
* void: Your application need not return a value, as the JVM launcher would return the value when it exits
* main(): This is the entry point for the application - Line 3: curly braces opens here or just immediately after method name
- Line4 : Printing the String constant into the console
- Line5 : close the bracket for method
- Line 6 : close the bracket for class JavaDemo
And Run the program by typing the below command
-> java JavaDemo
You can see the following output
HelloWorld!
follow me on twitter::http://twitter.com/shamsudeen
No comments:
Post a Comment