1. Overload: follow the "two with three different"
With two: with the same method on a class
Three different: different parameter types, the number, order
special reminder:
- The return value can not be a different configuration method overloading
- Parameter name constitute different method overloading
2. Overwrite (overwrite) requirements
- Name of the child class method, the return type must match the parent class.
- Subclass method can not be reduced access to the parent class method
- Subclass method can not throw more of an exception than the parent class method
- The method of covering exists only in the parent class and subclass, the method of the same class can be overridden
- Static parent class method can not be overridden by subclasses
- Subclasses can define a static method with the same name as the parent class's static method
- Non-static methods of the parent class is not a static method subclasses cover
- Private parent method can not be overridden by subclasses
- Abstract parent class can be overridden by a subclass in two ways: ① ② again to achieve the abstract method is defined as an abstract class or method is implemented by Sun continues to abstract
- The method of non-abstract parent class may be covered as an abstract method