代码拉取完成,页面将自动刷新
package cn.hfkh.oop04;
class Person03 {
String name = "李光"; //姓名
public Person03(){
//super();写不写该句,效果一样
System.out.println("execute Person03()");
}
public Person03(String name){
this.name = name;
System.out.println("execute Person03(name)");
}
}
class Student extends Person03{
String school = "北大青鸟"; //学校
public Student(){
//super();写不写该句,效果一样
System.out.println("execute Student()");
}
public Student(String name, String school){
super(name);
this.school = school;
System.out.println("execute Student(name,school)");
}
}
class PostGraduate extends Student{
String guide; //导师
public PostGraduate(){
System.out.println("execute PostGradute()");
}
public PostGraduate(String name,String school,String guide){
super(name,school);
this.guide = guide;
System.out.println("excute PostGraduate(name,school,guide)");
}
}
class TestInherit{
public static void main(String[] args) {
PostGraduate pgdt = null;
pgdt = new PostGraduate();
System.out.println();
pgdt = new PostGraduate("刘志同","北京大学","王老师");
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。