AndreaNobili AndreaNobili - 1 year ago 65
Java Question

Can I have more than one class containing the main() method in a Java project?

I have a doubt about Java.

In a Java project (handled by Eclipse for example), can I have more classes that contain the main() method and consequently can I chose to execute one class or another class?



Som Som
Answer Source

Yes, you can have more classes that contain the main() method, but at least one class which contain main() should be public so that JMV will start that class as Main thread

  • as the code written by aUserHimself represent
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download