How method resolution done in overloading and overriding ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How method resolution done in overloading and overriding ?

In overloading method resolution always takes care by compiler based on reference type. hence overloading is also considered as compile time polymorphism. In overriding method resolution always takes care by JVM based on runtime object.hence overriding is also considered as runtime polymorphism

10th Jan 2017, 6:07 PM
uday chafale
uday chafale - avatar
2 Answers
+ 1
Overriden methods will always be resolved, if I'm not wrong. The only way to refer to an overriden method is like super.overiddenMethod(). About the overloading, the JVM will look for the method with same references. There's no much to say about it. There can't be methods with the exact same parameters available for a class unless it is overidden. And if it overrides it should be the best resolution for the problem.
13th Jan 2017, 4:41 AM
Daisoraki
Daisoraki - avatar
0
okay thank you 👍
13th Jan 2017, 4:55 AM
uday chafale
uday chafale - avatar