Domanda di colloquio di Tata Consultancy Services

What is the difference between method overriding vs overloading

Risposte di colloquio

Anonimo

17 set 2020

They both are example of polymorphism, method overloading (compiler time polymorphism)is when you have the same method but change its signature , parameters or even return type method overriding (run-time polymorphism) is when you have a method that that belongs to an extended class and and you change its behavior, commonly use the @Override anottation on top of the method.

1

Anonimo

9 ago 2017

Method of overriding has two methods with same arguement but different implementation. Method of overloading deals with the notion of having two or more methods in the same class with the same name but different arguments.

2