0 votes
in JAVA by
What is overriding in java?

1 Answer

0 votes
by

What is overriding in java?

1) Method overriding is a process of overriding base class method by derived class method with a more specific definition.

2) Method overriding performs only if two classes have an is-a relationship. It means class must have inheritance. In other words, It is performed between two classes using inheritance relation.

3) In overriding, method of both classes must have the same name and an equal number of parameters.

4) Method overriding is also referred to as runtime polymorphism because the calling method is decided by JVM during runtime.

The key benefit of overriding is the ability to define a method that’s specific to a particular subclass type.

Related questions

0 votes
asked May 25, 2020 in JAVA by Robindeniel
+1 vote
asked May 24, 2019 in JAVA by rajeshsharma
...