If you are running your Java application via the java[.exe] program that comes with the JRE or JDK, then it enters via a method called "main" in the class that you specify on the java[.exe] command line. It must be public and static and accept an array of Strings.
The reason for this is that this is what the Java Language Specification requires. There is no more fundamental reason than that the language designers had to choose something and they thought a public static method called "main" would be reasonably obvious and memorable.
The language designers could have chosen something quite different. For instance, they could have said that the class must be Runnable and have a no-args constructor; the java[.exe] would than have instantiated the class and called run(). I think that would have been better, actually, but...
There are other ways to start a Java application that do not go via main(). However, that's probably beyond this Beginner forum.
The answer to many "why does Java ...?" questions is really just "because the spec says so". As a beginner, it is not wise to spend large amounts of time worrying about the "why" questions. Learn to use Java first. [ October 09, 2007: Message edited by: Peter Chase ]
Post by:autobot
What's a year in metric? Do you know this metric stuff tiny ad?
a bit of art, as a gift, the permaculture playing cards