Pages

get our extension

Search program

Friday 12 April 2013

Meaning of public static void main(String args[])


public :- Public is a keyword and denotes that JVM(Java virtual machine) can call
              the main() method without any restrictions to begin execution of the program.

static :- It is a keyword and denotes that it be available for execution without an object instance.
            "static" keyword can be applied to instance variables and methods and not with classes and local     
            variables. we cannot begin execution of a class without its object if the main method was not static.

void :- void means no value. main() method does not return any value, so void should be written before that  
           method's name. if we want the method to return the result in form of an integer, then we should
           write int before the method name.

String args[]:- The values passed to main() method are called arguments. these arguments are stored into 
                      args[] array. args[] is the array name and it is of String type. this means that it can store a  
                      group of strings. this array can also store a group of numbers but in the form of string only.

No comments:

Post a Comment