Methods Overloading Example in Java

www‮al.‬utturi.com
Methods Overloading Example in Java

method overloading is the ability to create multiple functions of the same name with different implementations. Calls to an overloaded function will run a specific implementation of that function appropriate to the context of the call, allowing one function call to perform different tasks depending on context.

public static int sum(int x, int y) {
  return x + y;
}

public static int sum(int x, int y, int z) {
  return x + y + z;
}
Created Time:2017-09-04 20:32:46  Author:lautturi