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

1 reply · 2K views · last reply
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?