In a nutshell, overloading is the same as allowing more than one method of the same name to exist in the same class, as long as the number or type of arguments for these methods is different, and resetting (overwriting) is a subclass that defines a method that has already been defined in the parent class, that is, subclasses overriding the parent class method.
Overloading of methods
The overload of a method is to allow more than one method of the same name to exist in the same class, as long as the number or type of arguments for these methods is different . There are three kinds of situations:
1. The number of parameters is different, which makes up overloading
Public int Add (int A,int b) { return a +b;} Public int Add (int a) { return A}
2. Different parameter types, which make up overloading
Public int int A,int b) { return a +b;} Public Double Double A,double b) { return a +b;}
3. The parameter order is different, which makes up the overload
Public int int A,double b) { return 1;} Public int Double A,int b) { return 1;}
Note: Although the return values of two methods can be different in a method overload, only the return values are not sufficient to determine whether the overloads are overloaded or not, and are set by the number of arguments and the type.
The difference between overloading and resetting (overwriting) methods in Java