what is the mening of public static void main in java
why public static void main ( string [] args ) used in java
public:
public is a access specifier .it means from every where we can access it. main function access modifier must me public.so it can be found by jvm ,when the class is loaded.Static:
static means we can call this method directly using class name,without creation an object.main method must be static for call this method after load the class.[we are not create main method object so for main method we used static]void:
Every function has a return type.it can be int,float,double,string . but in java main method return type must be void.string[]args :
string is a pre-define class in java.java accept only string type of argument,and args is a name of this string.we can used another it not a fact.EX: string[] xyz, string xyz[].
Good explain
ReplyDelete