1. The interface:

Because Java does not support multiple inheritance, there are interfaces. A class can inherit only one parent class, but can implement multiple interfaces, and interfaces themselves can inherit interfaces.

Member variables in an interface are private by default and must be initialized

Methods in interfaces default to implicit declarations of type public Abstract

The interface has no constructor and cannot be instantiated

An interface cannot implement another interface, but can inherit multiple interfaces

If a class implements an interface, it must implement all the methods in the interface. Otherwise, the class is defined as abstract

2. Abstract class

If a class is declared abstract, it cannot generate objects and can only be inherited

Abstract methods must exist in abstract classes

Abstract classes can have general variables and methods

A subclass that inherits an abstract class must implement its abstract methods.

The difference between

1. Neither interfaces nor abstract classes can be instantiated

2. Interfaces do not contain constructors, and abstract classes can contain constructors

3. Interfaces can only contain abstract methods, and abstract classes can contain ordinary methods

4. The interface can only define static final properties (public static final). Abstract classes can define ordinary variables and static constant properties