there is no "main function" in Java, only a "main method".
It is required to have the exact signature "public static void main(String[] args)" or a lexical equivalent (it can for example be made final, or you may use another name instead of args).
Without that the JVM will not start executing the program.
There is one way to get something done, but that's NOT running a program.
That way involves creating a static initialiser block in the class, which will be executed at class loading time.
This smells horifically like a homework question so I won't show you how to do it
Reputation Points: 1658
Solved Threads: 331
duckman
Offline 7,719 posts
since Nov 2004