Jobs

Java OOPS : 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.
Note:

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).

*       You cannot override a method marked final

*       You cannot override a method marked static