Quiz
Let's test your understanding of the concept of polymorphism with the help of a short quiz.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
What is the output of the following piece of code?
class Base {
public Base() {}
public void print() {
System.out.println("Base");
}
}
class Derived extends Base {
public Derived() {}
public void print() {
System.out.println("Derived");
}
}
class Demo {
public static void main(String args[]) {
Base obj = new Derived();
obj.print();
}
}
A.
Base
B.
Base Derived
C.
Derived
D.
None of the above
1 / 5