Tuesday, November 29, 2011

What is method overriding?

Method overriding occurs when sub class declares a method that has the same type arguments as a method declared by one of its superclass. The key benefit of overriding is the ability to define behavior that?s specific to a particular subclass type.<br>Note:<br><br> The overriding method cannot have a more restrictive access modifier than the method being overridden (Ex: You can?t override a method marked public and make it protected).<br> * You cannot override a method marked final<br> * You cannot override a method marked static<br>
Category:Core Java Interview Questions

No comments:

Post a Comment