More than 25 states

pass。。

 

public class PoymorphicDemo {
    public static void main(String[] args) {
        Animal a = new Cat();
        a.eat();
    }
}

class Animal {
    public void eat() {
        System.out.println("吃东西");
    }
}

class Cat extends Animal {
    @Override
    public void eat() {
        System.out.println("啃骨头");
    }
}

Export

 

Guess you like

Origin www.cnblogs.com/longesang/p/11234787.html