Tuesday, November 29, 2011

can we declare multiple main() methods in multiple classes.ie can we have each main method in its class in our program?

Yaa u can declare multiple main methods in different classes, this wont through any error while complition , but it through u runtime exception stating that no main method found.So there should be only one main method in a program:Yaa u can declare multiple main methods in different classes, this wont throw any error while completion , but it throws u runtime exception stating that no main method found.So there should be only one main method in a program.
Category:Java Interview Questions

No comments:

Post a Comment