CAN AN APPLICATION HAVE MULTIPLE CLASSES HAVING MAIN() METHOD?

Sumit Kesarwani

Total Post:782

Points:3910
Posted by  Sumit Kesarwani
Java 
 1011  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    Can an application have multiple classes having main() method?

    Yes it is possible. While starting the application we mention the class name to be run. The JVM will look for the Main method only in the class whose name you have mentioned.

    Hence there is not conflict amongst the multiple classes having main() method.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!