How does java know what class to invoke the main() method of?

  • Context: Java 
  • Thread starter Thread starter Whovian
  • Start date Start date
  • Tags Tags
    Class Java Method
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Whovian
Messages
651
Reaction score
3
In C++, pretty much any global main() function gets run. In C#, amy class's Main() method gets run, and having multiple Main() methods in multiple classes should give a compilation error(?). But if we have a .jar, when running it, how do we know which class's main() method the .jar will run?
 
Physics news on Phys.org