62,614
社区成员
发帖
与我相关
我的任务
分享
public class test6 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Hippo h= new Hippo();
}
}
public class Hippo extends Animal {
public Hippo() {
// super(); 这里写不写都没关系,强制会调用super();
// TODO Auto-generated constructor stub
System.out.println("This is Hippo!");
}
}
public class Animal extends Object {
public Animal() {
// TODO Auto-generated constructor stub
System.out.println("This is Animal!");
}
}
public class Object {
public Object() {
// TODO Auto-generated constructor stub
System.out.println("This is Object!");
}
}
运行test6结果:
This is Object!
This is Animal!
This is Hippo!