Click on following link to know all about Overriding in Java
Some key points about overriding in java
- The overriding method must have same arguments, it means return type of
argument should be same with number of argument.
- The overriding method must have less restrictive access modifier.
- The return type of overriding method must be the same.
- If you want your method not to be overridden mark it with final at the
- With context of constructor it can be overloaded but cannot be
- The concrete class overrides the abstract method.
- The private method is not overridden.
- A default method may be overridden by a default, protected or public
- A public overridden method then the overriding method must also be in
public. But in the case of protected it can be overridden by protected and
- A protected method may not be overridden by a default or private method.
More about Overriding