Meaning of an abstract class
Abstract meaning: For CodeMaintenanceAndReuse.
Abstract classes are often used to represent the abstract concepts obtained from the analysis and design of problem domains. They are the abstraction of a series of seemingly different but essentially identical specific concepts. The specific analysis is as follows:
1. Because an abstract class cannot instantiate an object, you must have a subclass to implement it before using it. In this way, components with the same attributes and methods can be abstracted to facilitate code and program maintenance.
For example, undergraduate and graduate students can be abstracted into students. They have the same attributes and methods. In this way, when you modify a class, it will be restricted by the parent class. This will remind developers that some items cannot be modified at will, in this way, we can impose unified restrictions on important things, which is also a kind of protection and will be of great help to maintenance.
2. When another similar component is generated, you only need to implement this abstract class to obtain the attributes and methods of this abstract class.
For example, if the school has new students such as junior college students, the junior college students directly inherit the students and then supplement their own attributes and methods. This is a good embodiment of code reuse.
Therefore, abstract classes in Java are very helpful for code maintenance and reuse, and are also an important embodiment of Java object-oriented.