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

Posted on    July-21-2015 10:32 PM

 Java Java 
Ratings:
 1 Answer(s)
  355  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Points:4035
Posted on    July-21-2015 10:32 PM

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