You can define overloaded methods with different parameter types, as follows:
class Championship {
static boolean reward(Integer lapTime) {
return(lapTime < 60);
}
static boolean reward(String lap) {
return(lap.equalsIgnoreCase("final ");
}
}
However, the following code doesn't compile:
someMethod(Chamionship::reward); // ambiguous call
In the preceding line of code, since the compiler is not allowed to examine the method reference, the code fails to compile. This is unfortunate since the method parameters to the overloaded methods are Integer and String—no value can be compatible with both.