对于如下代码,描述正确的是( )
class Animal{
public void move(){
System.out.println("the animal is moving");
}
}
class Dog extends Animal{
public void move(){
System.out.println("the dog can run");
}
public void bark(){
System.out.println("the dog can bark");
}
}
public class TestDog{
public static void main(String args[]){
Animal a = new Animal();
Animal b = new Dog();
}
}
Aa 对象可以调用move方法,输出为:the dog can run
Ba 对象可以调用move方法,输出为:the animal is moving
Cb对象可以调用bark方法输出为:the dog can bark
Db 对象不能调用bark方法。