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?


March 03, 2009 01:42:53 #8
 meghanalwa   Member Since: March 2009    Total Comments: 1 

RE: Overriding Methods
 
Super-class and Sub-class have method of same name.
The programe compile easily but at run time it decide which method to be loaded. Weather sub-class or super-class. This concept is called as method over-riding.
     

 

Back To Question