Features of the JAVA sub-parent class and java features
I. variables (attributes)
This indicates the reference of the current object. this variable is first found in this class. If it is not found, it will be found in the parent class.
Super is used to access the current object's parent class member super. The variable is directly located in the parent class
Ii. Functions (methods)
When the same function in the parent class appears in the subclass, when the subclass object calls this function,
It runs a function in the subclass, just as the function in the parent class is overwritten,
This is another feature of the function: rewrite (overwrite)
Note:
1. When a subclass member overwrites a parent class member, you must ensure that the permission of the subclass is greater than or equal to that of the parent class. Otherwise, the compilation fails.
Access permission modifier: the default private member of the public default does not have any access permission modifier before the default permission is defalut.
2. Static only covers static
Remember:
Overload: view the parameter list of methods with the same name.
Rewrite: the sub-parent class methods should be identical
Iii. Constructor (constructor)
When a subclass is created, the constructor of the subclass is called and the constructor of the parent class is automatically called.
The syntax for manually calling the parent class constructor is: super ();
The syntax for manually calling the current class constructor is: this ();
The two syntaxes can contain parameters or no parameters.
Word: super means "super"