class Teacher extends Person {
public Teacher() {
super();
}
public Teacher(int a) {
System.out.println(a);
}
public void func() {
System.out.print("4, ");
}
public static void main(String[] args) {
Teacher t1 = new Teacher();
Teacher t2 = new Teacher(3);
}
}
class Person {
public Person() {
func();
}
public void func() {
System.out.println("1, ");
}
}
上面的代码,为啥结果是4,4,3,而不是4,3
我怎么考虑,都是4,3 ,
请高手指教一下,我哪块错了 |
|