in JAVA by

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

When to use overriding in java

If we want same method with different behaviour in superclass and subclass then we go for overriding.

When we call overridden method with subclass reference subclass method is called hiding the superclass


Related questions

0 votes
asked Jun 16, 2019 in JAVA by reins.robin