能编译通过,但是结果不对,不知道是哪里错了class Person{private String name;private String location; Person(String name){this.name=name;location="beijing";}Person(String name,String location){this.name=name;this.location=location;}public String info(){return "name:"+name+"location:"+location;}}class Student extends Person{private String school;Student(String name,String school){this(name,school,"beijing"); }Student(String n,String l,String school){super(n,l);this.school=school;}public String info(){return super.info()+" school:"+school; }}
添加回答
举报
0/150
提交
取消