What is Method Overloading?

Method Overloading:

One or more methods  in a class having same name, but different number or type of arguments, is called method overloading.

When a overloaded method is called, the method with matching number and type of arguments gets executed.

If there is no exact match of argument types, type promotion is applied, before invoking the method.

For eg

class Abc{

void add(int i, int j){  //body of method }

void add(float i, float j, float k){ //body of method }

void add(int i,int j, int k){ //body of method }

}

NOTE:

1.Method overloading cannot be done, based only on return type of the method

2.Method overloading is compile time polymorphism, as the method which need to get called is decided/binded during compile time itself.

Question:

Can below methods be overloaded??

class Abc{

void add(int i, int j){  //body of method }

int add(int a, int b){ //body of method }

}