抽象类
- 由关键字 abstract 创建抽象类
- 抽象类不能被实例化
语法
AbstractBase.java
abstract class AbstractBase{
abstract void show();
}
AbstractLearn.java
public class AbstractLearn extends AbstractBase{
public void show(){
System.out.println("=AbstractLearn=");
}
}
EnterAbstract.java
public class EnterAbstract{
public static void main(String[] args){
AbstractLearn al = new AbstractLearn();
al.show();
}
}