Interface
1 because Java does not support multiple inheritance, there is an interface, a class can inherit only one parent class, but can implement multiple interfaces, the interface itself can inherit multiple interfaces.
The member variables in the 2 interface are public static final type by default. The initialization that must be displayed.
The method in the 3 interface is the public abstract type by default. An implicit declaration.
The 4 interface has no constructor method and cannot be instantiated.
The 5 interface cannot implement another interface, but it can inherit multiple interfaces.
Class 6 If you implement an interface, you must implement all the abstract methods inside the interface, otherwise the class will be defined as an abstract class.
Abstract class
1 If you declare a class as abstract, this class cannot generate objects and can only be used by inheritance.
2 The abstract method must exist in an abstract class.
3 There can be general variables and general methods in the abstract class.
4 Subclass inheriting an abstract class must implement an abstract method, unless the subclass is an abstract class.
private void Print () {}; This statement represents a null implementation of the method.
abstract void print (); This statement represents the abstraction of the method, without implementation.
The difference between an interface and an abstract class
The 1 interface can contain only abstract methods, and abstract classes can contain common methods.
The 2 interface can only define static constant properties, and abstract classes can define either normal properties or static constant properties.
The 3 interface does not contain a constructor method, and an abstract class can contain a constructor method.
An abstract class cannot be instantiated, but it does not mean that it can have constructors, that abstract classes can have constructors, and that they inherit class extensions
Abstract classes and Interfaces in Java