No, Java does not allow method overloading based solely on different return types. For method overloading to be valid, the methods must have different parameter lists, such as a different number of parameters, different parameter types, or a different parameter order.
The following code is invalid because both methods have the same signature and differ only in their return type.
class Calculator {
int calculate() {
return 100;
}
double calculate() { // Compilation Error
return 100.0;
}
}method calculate() is already defined in class Calculator
Why Is It Not Allowed?
calculate();
The compiler cannot determine whether it should call the int version or the double version because the method call is identical.
class Calculator {
int calculate(int num) {
return num;
}
double calculate(double num) {
return num;
}
}Here, the parameter types are different, so overloading is valid.
display(int a)
display(int a, int b)display(int a)
display(String a)display(int a, String b)
display(String b, int a)int display(int a)
double display(int a)
The above methods are invalid because only the return type differs.
A concise interview answer is
No, methods cannot be overloaded solely by changing their return type. Java determines overloaded methods using the method name and parameter list, not the return type. To overload a method, the parameters must differ in number, type, or order.
Last updated: 1 November 2026
Previous question: How does the Java compiler determine which overloaded method to call?
Next question: What are the rules for method overloading in Java?