Inheritance and interfaces are two of the most important concepts in OOP programming languages, and often confuse programmers with their use. When to use inheritance better, when to use the interface better?
First of all, from the multi-state characteristics of OOP programming language, both are a manifestation of polymorphism. Inheritance is more focused on categorizing objects (inheritance systems) and interfaces focusing on classifying functional methods.
Each class belongs to a particular inheritance system, and all class-up conversions can eventually be turned into a single base class. Inheritance will "do what" and "how to" coupled together, if you need to reuse existing methods must add the new class to the existing inheritance system (or adopt wrapper class).
Interfaces can be "what" and "how to" separate, you can convert up to more than one base class.
Abstract classes are a buffer between interfaces and classes, and are a very important tool in the process of programming. Because we can't always use pure interfaces. For example, there is an interface a, if you use a pure interface method. A1,A2,A3 is all A's implementation class, if the A interface new or modified any old method will affect three implementation classes, if the use of abstract classes to buffer can be implemented in the abstract class, and then a1,a2,a3 on-demand overlay methods in the abstract class to achieve the least impact.
This article from "Insist on learning" blog, declined reprint!
Java Basics-Inheritance, abstract classes, interfaces