super问题。
下面不知道什么问题,老实在super那里出错,帮忙找找大家。
、============================
class Person {
String name;
int id;
Person (String name, int id) {
this.name = name;
this.id = id;
}
public String info() {
return "name:" + name + "\n" + "ID:" + id;
}
}
class Teacher {
String prof;
Teacher (String n, int i, String prof){
super(n,i);
this.prof = prof;
}
public String info(){
return "name:" + name + "\n" + "ID:" + id +"\n" +"Prof" + prof;
}
}
public class Test1 {
public static void main(String args[]) {
Person r = new Person("zhangsan",23);
Teacher t = new Teacher("laozhang",35);
System.out.println(r.info());
System.out.println(t.info());
}
}
++++++++++++++++++++++