In java programs, the main method is not required. As others noted, web applications do not use the main method.
This is not even required in standalone applications. Consider
class JavaAppWithoutMain { static { System . out . println ( "Hello World!" ) ; } }
I compiled it and ran and got the following result:
Hello World! Exception in thread "main" java.lang.NoSuchMethodError: main
For standalone applications you must have
- main method or
- static initializer.
Basic is preferred.
emory
source share