I subscribe to the Java Technology Fundamentals newsletter. In the 7/7/2003 newsletter, it says: "Overloading is the ability to have a class with multiple methods of the same name where the arguments and return type (method signature) allow the compiler to determine which of the same named methods were meant to be called." I always thought that a method signature did NOT include the return type. Indeed, if I try to enter two methods with the same name, same arguments, and different return types using my IDE (WSAD 5), it is flagged as an error (Duplicate method name). I've always thought it would be useful to specify methods whose only difference is in the return type. Is this statement incorrect or is it possible to create methods whose only difference is the return type?
Ernest Friedman-Hill
author and iconoclast
Marshal
Yes, Method Signature is including the method name and parameter list,but it is NOT including the return type. So the following statement is false "Overloading is the ability to have a class with multiple methods of the same name where the arguments and return type (method signature) allow the compiler to determine which of the same named methods were meant to be called."