Hi friends
I want to know that can we make more than one main function in a single java file. How to run every class in this file.
Thank you.
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 Apr 9, 2012, 2:29 PM
VulpesPosted Apr 10, 2012, 5:59 AM
If you compile this program with JDK 1.6, two class files will be generated - MyClass.class and YourClass.class.
If you then run MyClass, you should see the following output:
Hello from MyClass
Hello from YourClass
The program will also work without error if you run YourClass but the output then will be the single line:
Hello from YourClass
Vipendra VermaPosted Apr 9, 2012, 6:47 PM