overloading: one difference. Method names are the same, parameter lists are different. Other parts of the method, such as the method return value type, modifier, and so on, have no relation to the method overload. The reason why the overloads cannot be distinguished by the return value is that there are now two methods int f (), String f (), when we call the F () method, if we specify its return type, int a = f (), then the int f () method is called, but when we direct F () , it cannot be distinguished, so the overload cannot be determined by the difference in the return value.
Rewrite: Two with two small one big. Both: The method name is the same and the formal parameter list is the same. Two small: The subclass method return value type should be smaller or equal than the parent class method return value type, the subclass method declaration excludes exceptions that are less or equal than the exceptions thrown by the parent class method. A large: The subclass method should have greater or equal access to the parent class method, especially to point out that both the overriding method and the overridden method are either class methods or instance methods, not one class method and one instance method.
Java Learning (ix) overloading and rewriting