Runtime polymorphic behavior

Report a typo

You have an inheritance hierarchy consisting of two classes.

The base class.

public class BaseClass {

    public void print() {
        System.out.println("Base class");
    }
}

The derived class.

public class DerivedClass extends BaseClass {

    public void print() {
        System.out.println("Derived class");
        super.print();
    }
}

What is the output of the code below?

BaseClass clazz = new DerivedClass();
clazz.print();
Select one option from the list
___

Create a free account to access the full topic