Why i can’t initialize variable in parent class’ constructor? [closed]

read the message of the error of the compiler!

Implicit super constructor Base() is undefined. Must explicitly invoke
another constructor

your child class must call the constructor of the parent class

Child(int b) {
    super(b);
    this.b = b;
}

Leave a Comment