We declare, main method in java as : public static void main(String args[])
public : means it can be accessible to all other classes.
static : main is the entry point of a class. In java everything thing is written in a class.Now when you run java filename on command prompt, loader will load the class and jvm will search the main method to enter into the class. so making the main() as static, will make jvm access it directly through classname.main()
Now once jvm get the main(), object instantiated there are accessed.
void : main method should return anything.
main : its the method name, the JVM will seek for after the class is loaded on runing command like e.g java classname
String args[] : String array named args used to access the string variables passed on command line. e.g java classname firstname lastname
For further reading:
http://www.dreamincode.net/forums/index.php?s=eac3b49d45a9277f36a31b233588f6a5&showtopic=38921





