In a class, there can be several methods sharing the same name but differ in
- Parameter types
- Number of parameters
- Order of the parameters declared in the method
By depending on the parameters provided for the method, in the run time, compiler determines which version of the method to execute.
An overloaded method may or may not have different return types. But return type alone is not sufficient for the compiler to determine which method is to be executed at run time.