裁判测试程序样例中展示的是一段定义基类People
、派生类Student
以及测试两个类的相关Java代码,其中缺失了部分代码,请补充完整,以保证测试程序正常运行。
函数接口定义:
提示: 观察派生类代码和main方法中的测试代码,补全缺失的代码。
裁判测试程序样例:
注意:真正的测试程序中使用的数据可能与样例测试程序中不同,但仅按照样例中的格式调用相
public People()
{
}
public People(String id,String name)
{
this.id=id;
this.name=name;
}
public void setId(String id)
{
this.id=id;
}
public void setName(String name)
{
this.name =name;
}
public String getId()
{
return id;
}
public String getName()
{
return name;
}
public void say()
{
System.out.println("I'm a person! My name is " + this.name + ".");
}