1. Method overload overloading, is in a class, there are multiple methods, the names of these methods are the same, but with a different parameter list, and the return value overloads, the method name is the same, but the parameter type and the number of arguments are different, the return value type can be the same, or can be a difference, You cannot determine whether a method is overloaded with a return value type. 2The . Method overrides the overriding, which is present between the parent class and the child class (1The method in the Kawai class has the same method name, return type, and parameter table as a method in the parent class, and the new method overrides the method in the parent class, such as to call the parent class method with the Super keyword (2The permission modifier for the overridden method of a subclass cannot be less than the parent class, or the rule that is greater than or equal to the parent class override method: (1), the argument list must be exactly the same as the overridden method, otherwise it cannot be called overridden but overloaded. (2), the returned type must always be the same as the return type of the overridden method, otherwise it cannot be called overriding but overloaded. (3), the restriction of the access modifier must be greater than or equal to the access modifier of the overridden method ( Public>protected>default>Private) (4), the overriding method must not throw a new check exception or a more generalized check exception than the overridden method declaration. For example: A method of the parent class declares a check exception ioexception, in overriding this method is not able to throw exception, can only throw IOException subclass exception, can throw non-check exception. Instead of overloading the rule: (1), must have a different list of parameters;2), can have a return type without scolding, as long as the parameter list is different;3), can have different access modifiers; (4), can throw different anomalies;
Permission modifiers
Method overloads and overrides in Java and method modifiers