When are "Math.abs", "Math.max", and "Math.min" the only examples of method overloading from the Math class?

+2 votes

Best answer

Do your mean why are those the only examples of method overloading from the Math class....or at least the Math class methods we've discussed?

Of those we've discussed, those methods have more than one "version" of the method with different signatures. A different signature means they have a different number of parameters or different types of parameters or both.

For example, Math.abs has one version that accepts an integer parameter and returns an integer and another version that accepts a double parameter and returns a double. The headers for the methods are public static int abs(int a) and public static double abs(double a). The abs method actually has two other versions for floats and longs too.

You can Google Java Math class to see all of the methods of the Math class. In that list, you can see many methods that have more than one "version". Each of those methods is overloaded.