The main content is from MIT6.031 software construction course and hit software construction course.
Before we introduce the abstract class, let's talk about abstract methods.
Abstract methods are those methods that only method declarations (methods Signature), and no method body, or method implementations, are decorated with the abstract keyword.
The concrete implementation of the abstract method is usually done by inheriting the subclass of the class in which the abstract method resides.
The following is an abstract class:
Abstract classes are: Classes that contain at least one abstract method are abstract classes.
Interface (Interface):
Interfaces are an efficient way to design ADT (Abstract Data Type) in Java, by creating classes to implement an interface.
An interface can extend other interfaces, or it can implement other interfaces.
Starting with JAVA8, interfaces are also allowed to include static methods that can be used to perform creator operations such as constructors (constructor) and so on.
The relationships of abstract classes and interfaces are:
An interface is an abstract class that has only abstract methods, and an interface is a special kind of abstract class.
Abstract classes and Interfaces in Java