AP Computer Science Amediummcq1 pt

If Animal a = new Dog() and Dog overrides speak, then a.speak()

A.calls Dog's speak
B.calls Animal's speak
C.fails to compile
D.calls Object's speak

Explanation

Core Concept

Dynamic dispatch uses the object's class.

Correct Answer

Acalls Dog's speak

More Unit 9: Inheritance practice questions

Try a random question →

Practice more AP Computer Science A questions with full explanations

Practice Unit 9: Inheritance Questions →