Multiple Choice
Let Dog be a subclass of Animal, and suppose Animal has a method called speak() that is overridden in the Dog class. Consider the following code. Animal spot = new Dog() ;
Spot.speak() ;
Which of the following is true?
A) This code will result in a compile-time error.
B) This code will result in a run-time error.
C) The speak method defined in the Animal class will be called.
D) The speak method defined in the Dog class will be called.
E) The speak method will not be called at all.
Correct Answer:

Verified
Correct Answer:
Verified
Q21: In Java, polymorphic references can be created
Q22: A parameter to a method can be
Q23: What is an interface?
Q24: Describe the Iterator interface.
Q25: How do interfaces relate to multiple inheritance?
Q27: Suppose you are implementing the comparable interface
Q28: An interface name may be used as
Q29: If a class implements an interface, it
Q30: Why can't an interface be instantiated?
Q31: Let Animal be an interface. Then it