Type Here to Get Search Results !

Java - public static void main(String args[ ]) - Explanation

0

Java - public static void main(String args[ ]) - Explanation

public static void main(String[] args) 
{
/*Your Code*/
}

public :

It is an Access modifier , public means everyone can access it. That means it's in global scope. As, main method is called by JVM (Java Virtual Machine) , which is actually out of the project scope, the access specifier of this method is public.

static : 

Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static. so here static is a keyword which is when associated with a method, makes it a class related method.

void: 

The return type of this method is void means there's no return value, void here is a keyword to specify that this method returns nothing.

main( )  :

The name of the method, main because it's the main method from where the program starts .

Note: main is not a keyword

String args[] :

Arguments to this method. This method must be given an array of Strings, and the array will be called 'args'. The main method is called only  if it’s formal parameter matches that of an array of Strings.




If you are have any doubts join the discussions below , our moderators will clarify your doubts .

Post a Comment

0 Comments

Top Post Ad

Below Post Ad