What is method overloading?

1 answer

Answer

1065424

2026-05-17 02:21

+ Follow

Method overloading is when you have multiple methods in a class that have the same name but a different signature.

Ex:

public void print (String s){

}

public void print(int a) {

}

If we use more than one same type of method but different parameters or parameter list with same no. of parameters within same class than it is called methodoverloading.

if we use more than one different type of method within same class than we dont call it method overloading

for example:

public void add(int a , int b){

systemout.println(a+b);

}

public void add(double a , double b){

systemout.println(a+b);

}

public void add(string a , string b){

systemout.println(a+b);

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.