Method Overloading
If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.Ways to overload:
class Adder {
static int add(int a, int b) {
return a + b;
}
static double add(double a, double b) {
return a + b;
}
}class TestOverloading {
public static void main(String[] args) {
System.out.println(Adder.add(11, 11));
System.out.println(Adder.add(12.3, 12.6));
}
}