Wednesday, February 19

Overloading vs Overriding in Java

Overloading and overriding are completely different. Only the notion about interface (function) name is same. Overloading is the ability to use same interface name but with different arguments. Purpose of functions might be same but the way they work will differ based on the argument types. Overriding is applicable in the context of inheritance. When there is a need to change the behavior of a particular inherited method, it will be overridden in the sub-class.



How to overload methods ?




How to override methods ?


No comments:

Post a Comment

Ads Inside Post