Method Overloading

Method Overloading allows multiple methods with the same name but different parameter lists.

public static int multiply(int a, int b) {
  return a * b;
}

public static double multiply(double a, double b) {
  return a * b;
}

Java chooses the correct method based on the number and types of arguments.

← PrevNext →