能编译通过,但是结果不对,不知道是哪里错了
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;
}
}
慕容3067478
倚天杖