Revature interview question

Explain method overloading and method overriding. What are the differences?

Interview Answers

Anonymous

May 7, 2020

Method overloading is when you have 2 or more methods in the same class with the same name but different parameters. Overriding is when the child class implements a method differently from its parent class.

1

Anonymous

Nov 17, 2020

Method Overloading is when a " method" different forms. more precisely when two or more method have the same name but a different number of parameters and/or data types For Example, take a method name "addNumber" can accept two int type parameter or two float type parameters. addNumber(int a , int b) addNumber(float a, float b) Method Overriding is when a child class overrides the parent class method and implements its own instruction. Method Override requires inheritance while method loading happens in the same class.