java课后作业

1.TestInherits

验证结果:

java课后作业

实验分析:

java课后作业

建立了两个不同参数个数的构造方法。

java课后作业

继承Grandparent并用super实现Grandparent(String string)的方法,并建立了自己的构造方法。

java课后作业

继承Parent同时也继承了Grandparent,并建立了自己的构造方法。

java课后作业

定义Child类的对象,完成了Child中的输出,因为Child类继承了Parent和Grandparent,所以也同时输出了他们的内容。