in JAVA by

Difference between method overloading and method overriding in java ?

Method Overloading Method Overriding
1) Method Overloading occurs with in the same
Method Overriding occurs between
two classes superclass and subclass
2) Since it involves with only one class inheritance
is not involved.
Since method overriding occurs between superclass
and subclass inheritance is involved.
3)In overloading return type need not be the same 3) In overriding return type must be same.
4) Parameters must be different when we do
4) Parameters must be same.
5) Static polymorphism can be acheived using
method overloading
5) Dynamic polymorphism can be acheived using
method overriding.
6) In overloading one method can’t hide the
6) In overriding subclass method hides that of the
superclass method.

Related questions

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