Features of the Java abstract class:
* Abstract classes cannot be instantiated
* Subclass inherits Abstract class and instantiates subclass
* Subclasses inherit abstract classes has penny must implement abstract methods in abstract classes
* Definition of abstract class * * *
* Definition of abstract method: Public abstract void * * * (); PS: Abstract method cannot have method body
---------------------------------------------------------------------------
Let's take the following code implementation:
Create a. java file first
Then we define an abstract class
Abstract classes cannot be instantiated directly, we can let subclasses inherit and instantiate subclasses
Then we instantiate the subclass
Let's try it out:
--------------------------
PS: Subclass inherits abstract class must implement abstract method in abstract class, if we are abstract class inherit abstract words also can not inherit abstract method, obviously abstract subclass also cannot be instantiated.
Abstract class inheriting abstract class: abstract class Student extends person{
}
---------------------------------------------------------------------------------------------------------
Come on, Oh!!!
Java abstract class/abstract method