What is method overriding:

DWQA QuestionsCategory: JavaWhat is method overriding:
Editor Staff asked 9 months ago

What is method overriding:

1 Answers
Editor Staff answered 9 months 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.