Resolving method overrides and overloads in Java inheritance
Method coverage
In class inheritance, a subclass can modify the methods inherited from the parent class, that is, a subclass can create a method with different functions from the parent method, but with the same name, return value type and parameter list.
If a method is defined in the new class and its name, return value type and parameter list are exactly the same as those in the parent class, the new method is called overriding the old method.
Parameter list is also called parameter signature, including parameter type, number of parameters and order of parameters. As long as there is one difference, it is called different parameter list.
Overridden methods can only be called through super in subclasses.
Note: override will not delete the method in the parent class, but hide the instance of the child class and will not be used for the time being.
Take the following example:
Operation results: