Inheritance (the execution order of the construction method--The parent class is no parameter, the subclass is no parameter, the parent class is not a parameter (because the constructor of the subclass is called the construction of the parent class at a time), the subclass has parameters)
1. Inheritance of member variables
(1), when a child class and the parent class defined a variable with the same name, the child class and the parent class with the same name variable exists simultaneously, does not interfere with each other (the parent class's variable is hidden in the subclass)
(2), undefined variables in subclasses can be inherited directly from the parent class
2. Inheritance of methods
(1), when a method of the same name, same type, same parameter is defined in a subclass, the method of the parent class is overwritten (invisible, even if it is not visible in the parent class)
(2), subclasses undefined methods can inherit directly from the parent class (that is, the subclass can directly use the public method in the parent class)
3. Super keyword
(1), how to use--
Access to the parent class's parameterless construction method--super ();
Access to the parent class with the parameter constructor method--super (parameter list);
Access the member variable--super of the parent class. Variable name;
4. Summary
(1), subclass unconditional inheritance of the parent class construction method
(2), if the subclass does not have a constructor method defined, it will use the parent class's parameterless construction method as its own constructor (excluding the parent class's argument construction method),
If a subclass defines a constructor method, the parent class has no parameter--and the subclass is no parameter---The parent class has no parameters (the contents of the subclass are not affected)--the subclass has a parameter
java--about inheriting a little personal understanding