您的位置:首页 - 题库 - Java
输出的内容是哪项?
public class Pet
{
private String name;
public Pet(String name)
{ this.name = name;
}
public void speak()
{ System.out.print(name);
}
}

public class Dog extends Pet
{
public Dog(String name)
{ super(name);
}
public void speak()
{ super.speak();
System.out.print(" Dog ");
}
}

执行代码
Pet pet = new Dog("京巴");
pet.speak();
后输出的内容是哪项?



评论: