What do you means by main function in Java- “public static void main(String args[])”?
Public: The keyword public is an access spacifier that declares the main methods as unprotected and therefore making it accessible to all.
Static: It is a keyword which declared this method as one that belongs to the entire class and not a part of any object of class. The main must always be declared as static. Since the interpreter uses this method before any objects are created.
void: The type modifier void state the main methods does not return any value.
String args []: All parameters to a method are declare inside a pair of parenthesis here string args declared a parameters name args, which contains an array of objects of the class type string.
No comments :
Post a Comment