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:  Overriding Methods

Answer: Suppose a Super Class method throws an exception and this method is Overriden in the subclass with no exception. Now if you create a super class reference that has a subclass object. This throws a compile time error, Why?


August 08, 2008 02:37:30 #4
 vegetto   Member Since: June 2008    Total Comments: 10 

RE: Overriding Methods
 
The answer to this question is pretty obvious that you need to supply the mean or the way to handle the exception either by declaring in the method itself or you should supply the catch statement or handle it in the caller method or the class that is calling the super class method and when you compile it again it would go fine.

cheers!!
     

 

Back To Question