Login Here                        

Main Method

Public static void main(String[] args)
Public:- To provide access permission to the jvm declare main is publc.
Static :- To provide direct access permission to the jvm declare main is static(with out creation of object able to access main method)
Void:- don’t return any values to the JVM.
String[] args:- used to take command line arguments(the arguments passed from command prompt)
String-----represents possible to take any type of argument.
[ ]---------represent possible to take any number of arguments.

Modifications on main():-

1) instead of : public static
          Possible to take : static public
2) the fallowing declarations are valied
         string[] args
         String args[]
         String []args
3) instead of : args
        possible to take : any variable name (a,b,c........etc)
4) insted of : String[] args
          possible to take : String args(only three dots represent variable argument )
5) the applicable modifiers are
         a. public
        b. static
        c. final
        d. strictfp
        e. synchronized

Which of the fallowing declarations are valied:-

public static void main(String[] args)-------valied
public static void main(String... a)---------valied
public static int main(String... args)-------invalied
static public void mian(String a[])----------valied
final public static void mian(String[] b)---valied
final strictfp public static void main(String[] c)-----valied
final strictfp synchronized public static void main(String...a)-------valied

main method program

class sup
final strictfp synchronized static public void main(String...a)

intput and output