1. Why do I need abstract classes? How do I define an abstract class?
* is a template mode. Abstract classes provide a generic template for all subclasses, which can be extended on the basis of this template.
* By abstract class, you can avoid the arbitrariness of sub-class design. Through abstract classes, we can strictly restrict the design of subclasses, so that subclasses are more common.
2. Key points:
Classes that have abstract methods can only be defined as abstract classes.
Abstract classes cannot be instantiated, and abstract classes cannot be instantiated with new.
An abstract class can contain properties, methods, and construction methods. However, the construction method cannot be used for new instances, only for the quilt class invocation.
Abstract classes can only be used for inheritance.
Abstract methods must be implemented by the quilt class, and the abstract parent class can also be inherited with an abstract subclass.
3. Abstract class is the class that contains the abstract method (abstract class)
4. The abstract method is that only the declaration of the method has no method body.
5. There can also be non-abstract methods in abstract classes.
6. An abstract class cannot construct an object but can be a type.
Abstract methods for Java abstract classes