填空题:Java程序阅读并填空
设有以下Java程序段,请阅读程序,并完成填空。
class Person {
String name,department;
public void printValue(){
System.out.println("name is "+name);
System.out.println("department is "+department);
}
}
public class Teacher extends Person {
int salary;
public void printValue(){
// 完成父类代码中printValue()相同的工作
System.out.println("salary is "+salary);
}
}
答案:
第1空:super.printValue(); ||
class Person {
String name,department;
public void printValue(){
System.out.println("name is "+name);
System.out.println("department is "+department);
}
}
public class Teacher extends Person {
int salary;
public void printValue(){
// 完成父类代码中printValue()相同的工作
System.out.println("salary is "+salary);
}
}
答案:
第1空:super.printValue(); ||