和视频中相同的代码为啥我的只显示“动物具有吃东西的能力”
package project1;
public class Animal {
public int age;
public String name;
public void eat(){
System.out.println("动物具有吃东西的能力");
}
public Animal(){
System.out.println("Animal");
}
}
package project1;
public class Dog extends Animal {
public Dog(){
System.out.println("Dog");
}
}
package project1;
public class Initail {
public static void main(String[] args) {
Dog dog= new Dog();
dog.age=10;
dog.name="xiaotian";
dog.eat();
}
}