Java面向对象知识测试

33:有一只狗和一只猫。

他们都有睡觉的方法,都仅仅是睡觉。 他们都有运动的方法,狗爱跑步,猫爱跳高。 请用所学知识体现把上面的代码体现出来。 然后在测试类中进行测试。

abstract class Animal { }

class Dog extends Animal { }

class Cat extends Animal { }

run()是抽象的。

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4