Possible duplicate:Java - why not method overload based on return type?
The compiler does not consider type return when differentiating methods, so you cannot declare two methods using the same signature, even if they have a different return type.Java Tutorial
Why is this?
Because to assign a result is not required if you want to execute a method. How does the compiler know which of the overloaded you want to call? There will be ambiguity.
, . , , . , , . , (short- > int) .
, , , , , . , .
.
,
Public Integer doStuff(String thing) { };
Public Double doStuff(String thing) { };
call doStuff doStuff, ( ) Double ( ).
WHY java ? , , :) , , .
- (un) , , , .
, , Java, Ada , . Google , , :
?