Because of the learning of Android, I looked back at Java about inheritance and interface, as well as the transition and downward transformation of the content.
If you are enlightened, understand the meaning of the interface, if there is a problem, please predecessors pointed out.
Interface will appear, the most important reason should be the emergence of the upward transition in Java, because the upward transition, the subclass of some of the parent classes do not exist in the method (or the common method) can not continue to invoke. This is troublesome, we need the methods in the subclass, but what do we do?
The first method of adding subclasses to the parent class. However, this method is actually not necessary in the parent class, and the method function body does not need it. Therefore, abstract methods are used, so that there is the birth of abstract methods. But even so, the problem is not resolved, because it is too troublesome, if there are other subclasses to inherit the parent class, it is inevitable that there will be upward transformation of the time, then, this time to the parent class to add an abstract method. is clearly unreasonable.
Then there is the second method, and the interface is born, which explains why the interface is an abstract method. So there is the interface, the subclass of the method required, but the parent class does not have the method can be directly used to complete the interface, there is no need to modify the method of the parent class, in many people work together to complete a project is also more convenient.
I can also say that interfaces must be written by people writing subclass methods.
(If there is a wrong, but also ask the predecessors to point out ~)