四个类,体现类的继承;抽象类的抽象和具像
//顶级父类,一切存在的抽象
public abstract class Things {
public abstract void grow();
public abstract void name();
}
//活的
public abstract class Living extends Things {
@Override
public void grow() {
Log.d(TAG, "Living things can grow.");
}
abstract void move();
}
//动物
public abstract class Annimal extends Living{
@Override
void move() {
Log.d(TAG, "Annimal can move");
}
abstract void moveStyle();
}
//狗
public class Dog extends Annimal{
//实现顶级父类的name方法
@Override
public void name() {
Log.d(TAG, "name: Dog ");
}
//实现直接父类的moveStyle方法
@Override
void moveStyle() {
Log.d(TAG, "moveStyle: run");
}
}