Hi,
can we declare multiple main() methods in multiple classes.ie can we have each main method in its class in our program?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Nov 7, 2011, 12:56 PM
However, the entry-point of the application will be the main method in the class passed to the java runtime. So, if you have a main method in a class called Test and you type this at the console:
java Test
then Test's main method will execute first.