Hello, I really can't seem to understand why method overloading and overriding is needed in java? I have read some article regarding this but not able to catch why it's needed practically? I am not clear with this topic. Any practical example will be appreciated.
Both are a lot different. Method overloading is performed within class. So you have two functions that has different set of parameters. Sum is a good example which takes integers as parameter and float as parameter. Method overriding occurs in inheritance relationship classes. Sum is already provided as the basic functionality in the parent class but you want to be dealing with it differently in the child class.