What is method overriding in java ?

If we have methods with same signature (same name, same signature, same return type) in super class and subclass then we say subclass method is overridden by super-class.
When to use overriding in java.

If we want same method with different behavior in super-class and subclass then we go for overriding.

When we call overridden method with subclass reference subclass method is called hiding the super-class method.

Example:-

Output:-