Friday, 22 May 2015

JAVA: public static void main(String[] args)

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

Public:  It is an Access Modifier, which defines who can access this method(In Java World). 
Public means that this method will be accessible to any class.Its scope is global throughout the 
application.
Static: It is a keyword which is accessible without creating the instance of class.
Void: It tells the return type of the method and void means that this method will not return 
anything.
main: This is the main method which is searched by JVM as starting point for an application.
String[] args:  These are the arguments to the main method. This method must be given an array of Strings, and the array will be called 'args'. These are called command line arguments. It is 
way to give input to the application at the runtime.





No comments:

Post a Comment