Home > DeveloperSection > Interviews > Can an application have multiple classes having main() method?

Posted on    August-23-2014 6:08 AM

 Java Java 
 1 Answer(s)
  973  View(s)
Rate this:

Sumit Kesarwani

Total Post:782

Posted on    August-23-2014 12:00 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick