Java Learning: the use of abstract methods and classes

abstract

Abstract methods : abstract is to add keywords, then remove the braces, ending direct semicolon.
Abstract class : abstract class where the method must be abstract class job. Before you can write the abstract class.

How to use abstract classes and abstract methods:

1. abstract class can not directly create new objects.


2. must inherit the abstract parent class with a subclass.


3. Subclasses must override the abstract parent class which covers all the abstract methods.
Overwrite (achieved): abstract subclass remove keywords abstract method, then fill the method body braces.


4. Create a subclass object for use.

 

Guess you like

Origin www.cnblogs.com/cainiao-chuanqi/p/11110199.html