Cannot refer to an instance field name while explicitly invoking a constructor 这是错误的提示
public class super_this语句结合 {
public static void main(String[] args) {
Students s = new Students("袁野");
}
}
class Person {
protected String name;
// Person(){}
Person(String name) {
this.name = name;
}
};
class Students extends Person {
Students() {
// super();
super(name); --------------在这里出现错误
}
Students(String name) {
this();
System.out.println("name");
}
};
说无法实例! 为什么啊? 求解? |