私は長い間これをやろうとしてきました。
public class bb extends test {
int t = 23;
public bb() {
super(t); //**This is the place that error comes**
// TODO Auto-generated constructor stub
}
public bb(int v) {
}
}
public class test {
public test() {
// TODO Auto-generated constructor stub
}
public test(int v) {
// TODO Auto-generated constructor stub
}
}
コントローラクラス
class s {
public static void main(String[] args) {
bb sd = new bb();
System.out.println("sdfsdfsdfd");
}
}
これが発生するエラーです。インスタンス変数をスーパークラスコンストラクターに渡せない理由を知りたいのですが?コンストラクターにアクセスできるインスタンスがないためだと思います。
スレッド「main」の例外java.lang.Error:未解決のコンパイルの問題:コンストラクターを明示的に呼び出している間、インスタンスフィールドtを参照できません