Super Keyword:
When the parent class is overridden, the subclass object cannot access the overridden method of the parent class, and super is to solve the problem:
1. Use the Super keyword to access the member variables and member methods of the parent class:
Super. Member variables
Super. Member method ([Parameter 1, ...])
2. Use the Super keyword to access the constructor of the parent class: (try to define an argument-free constructor in the class to avoid an error in inheritance).
Final keyword:
The 1.final keyword-decorated class cannot be inherited.
The 2.final keyword decoration method cannot be overridden.
The final modified variable in 3.java is called a constant, and once assigned, its value cannot be changed.
Abstract class:
Abstract methods: Methods that do not contain method bodies are abstract methods, and abstract methods must be decorated with the abstract keyword:
abstract void shout ();
Abstract class: When an abstract method is included in a class, the class must be decorated using the abstract keyword. Abstract classes may not contain abstract methods, but classes with abstract methods must be abstract classes. Abstract classes cannot be instantiated.
Interface:
1. If all the methods of an abstract class are abstract, you can define the class in a different way, that is, the interface.
2. An interface is a special class consisting of constants and abstract methods, which is a further abstraction of an abstract class, and the purpose of the interface is to implement multiple inheritance.
3. Use interface to declare.
4. The class to inherit the interface needs to use the Implements keyword, it is important to note that a class implementation of an interface, must give the interface of all the methods of implementation, if a method cannot be implemented, you must write an empty method.
5. Inheritance between interfaces with extends
6. A class can implement an interface while inheriting another class, at which point the extends keyword must precede the Implements keyword.
Upward transformation:
Use child class objects as parent classes
Downward transformation:
Use the parent class object as a subclass
java--super keyword, final keyword, abstract class, interface