[Solved] How to make this inheritance work in Java? [closed]


I’m not entirely sure what you want to achieve, but to get it compile, simply add implicit constructor to class a:

class a {

    public a(int x) {
        System.out.println(x);
    }

    public a() {
        // implicit constructor
    }
}

Since b extends a and doesn’t call the super constructor, implicit constructor of a is called “behind the scene”. Therefore a must provide one.

3

solved How to make this inheritance work in Java? [closed]