0
Can we run program without main method in Java?
Java Question
2 Answers
+ 4
If you wish to include Android apps, the code you write in Java does not have a main method. There still is one. It is just part of the supplied code libraries of the generic Android app.
All programming languages must have some form of entry point to pick where they start running from. Java uses a main method. Python picks the first line of the source file. These things are fixed and can't be changed without rewriting the compiler or interpreter for the language.
+ 4
According to my knowledge we cannot execute without a main method because when your running the java program. javaVirtual machine look for the main method.if JVM could not find the main method itwill show you run time error Exception in thread main could not find the mainclass.