What is method overriding:

Category: JavaWhat is method overriding:
Editor">Editor Staff asked 2 years ago

What is method overriding:

1 Answers
Editor">Editor Staff answered 2 years ago

If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding. It is used for runtime polymorphism and to implement the interface methods.
Rules for Method overriding
The method must have the same name as in the parent class.
The method must have the same signature as in the parent class.
Two classes must have an IS-A relationship between them.