GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java

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



October 10, 2005 05:41:44 #3
 suresh   Member Since: Visitor    Total Comments: N/A 

RE: can we declare multiple main() methods in multiple...
 
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
     

 

Back To Question