If subclass/child class has the same method as declared in the super/parent class (signature of method in both class should be same), it is known as method overriding in java.
In other words, If subclass provides the specific implementation of the method that has been provided by one of its parent class, it is known as method overriding.
Rules of Method Overriding:
- method must have same name as in the parent class
- method must have same parameter as in the parent class.
- must be IS-A relationship (inheritance).
Let us take one example: