Choose the class

Report a typo

You are given the following class hierarchy:

class A { }

class B extends A { }

class C extends B { }

class D extends A { }

Besides that, there are two classes returning new instances of some of the classes above:

class Producer {
    
    public B produce() {
        return new B();
    }
}

class XXXProducer extends Producer {
    
    @Override
    public XXX produce() {
        return new XXX();
    }
}

Which classes can be used instead of XXX to successfully compile the code?

Select one or more options from the list
___

Create a free account to access the full topic