Kizspy Question: 28
(Choose 1 answer)
Consider a superclass "Shape" with a method "draw()" and a subclass "Circle" that overrides the "draw()"
method. If an object of the "Circle" class is declared using the superclass type and the "draw()" method is
invoked, what will happen?
A. The "draw()" method of the superclass will be executed.
B. The "draw()" method of the subclass will be executed.
C. A compilation error will occur.
D. The "draw()" method will execute based on the type of the reference variable.
E. Both the "draw()" methods of the superclass and subclass will be executed.
F. The result depends on whether the "draw()" method is static or instance.