1. in the declaration of a class, create a subclass of a class with the keyword extends. A class declares itself to use one or more interfaces through the keyword implements.
Extends is inherited from a class, you can use the parent class method after inheritance, or you can override the parent class method; Implements is to implement multiple interfaces, the method of the interface is generally empty and must be rewritten to be used.
2.extends is inherited from the parent class, as long as the class is not declared final or the class is defined as abstract can inherit, Java does not support multiple inheritance, but can be implemented with interfaces, so it is necessary to use the implements, Inheritance can inherit only one class, but implements can implement multiple interfaces, separated by commas.
3. extends, you can implement a parent class, or you can call the parent class to initialize This.parent (). It also overrides the variables or functions defined by the parent class. The benefit is that the architect defines the interface so that the engineer can do it. The overall project development efficiency and development costs are greatly reduced. Instead of implements, implement the parent class, subclasses cannot overwrite the parent class's methods or variables. Even if the subclass defines a variable or function that is the same as the parent class, it is replaced by the parent class.
Summary: These two implementations of the specific use, is to see the actual situation of the project, need to implement, can not modify the implements, only the definition of the interface needs to be implemented, or can be modified to be good extensibility, with extends.
The use of extends and implements in Java