x

Java – Method overriding

PREV     NEXT

Java Method overriding:


If a method inherited from the superclass requires a different definition other than the definition provided in the superclass, then the method can be redefined or overridden. The process of redefining/overriding the method is called as Java – Method overriding.

The overridden method must have the same signature as that of the parent class method. Two methods are considered having same signature when their return type , method name, count and type of arguments are same.


Example For Java Method overriding:

Output:

Parrot is flying

The overridden method must have the same signature as that of the parent class method.

PREV     NEXT



Like it? Please Spread the word!