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?


April 04, 2009 23:28:51 #9
 sudhakarbaish   Member Since: April 2009    Total Comments: 1 

RE: Overriding Methods
 
According to Java compiler in case of over ridding always follow following rules: If a method of super class throws an exception then overridden version of that method in child class (sub class) should also throw same set of exceptions & should be properly handled.
If you agree vote me
sid
     

 

Back To Question