Main method in java

Is, discussion about public static void main(String args[]){}.
suppose, if i'm taking test class.
ex. class test{

                     }

here, test class doesn't main method. so what is that? test class compile or not. yes compile completely But, at run time error show that noSuchMethodError:main so, whether class method is contain main method or not is responsible for JVM(Java Virtual Machine). who is check this thing at run time. because of is JVM configuration that contain main method.

Now. public static void main(String args[]).
The question is Why JVM always configure this public staic void main(String args[]). so let's i explain.

public : you can call anyware. JVM call anywhere main method. JVM runs main method so, your JVM install anywhere in drive, either in d rive, c drive or anywhere so JVM call anywhere so that wise is use public.

static : static mean without existing object also JVM has to call method. or main method no way to any related to object.

void : void mean no return value. main method would not return anything to JVM.

main : main is the name which is configure inside JVM. so you can't to change main name on main method because JVM know main only name.

String args[] : This is command line argument. 

so, basically meaning of this main method. other we can learn next post. 

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



Comments