the meaning of ‘ public static void main(String args[])

The meaning of ‘ public static void main(String args[]) 

This is the line at which the program will begin executing. All Java applications begin
execution by calling main( ). Java is case-sensitive. Thus, Main is different from main. It is
important to understand that the Java compiler will compile classes that do not contain a main( )
method. However,the Java interpreter would report an error because it would be unable to find
the main( ) method.

The public keyword is an access specifier, main( ) must be declared as public, since it must be
called by code outside of its class when the program is started.

The keyword static allows main( ) to be called without having to instantiate a particular
instance (object) of the class. This is necessary since main( ) is called by the Java interpreter
before any objects are made.

The keyword void simply tells the compiler that main( ) does not return a value.
In main( ), there is only one parameter. String args[ ] declares a parameter named args, which is
an array of instances of the class String. Objects of type String store character strings. In this
case, args receives any command-line arguments present when the program is executed.

Comments