Suppose Animal is an interface that specifies a single method - speak. Now suppose the Dog class implements the Animal interface. In addition to the speak method, the Dog class also has a method called wagTail. Now consider the following code.
Animal a = new Dog() ;
A=wagTail() ;
Which of the following is true about this code?
A) It will result in a compile-time error.
B) It will result in a run-time error.
C) It will call the speak method defined in the Animal interface.
D) It will call the wagTail method defined in the Dog class.
E) none of the above are true.
Correct Answer:
Verified
Q9: The Comparable interface contains which of the
Q10: Consider the following line of code. Comparable
Q11: Let Dog be a subclass of Animal,
Q12: Let Object a be larger than Object
Q13: In Java, polymorphic references can be created
Q15: In order to create a class that
Q16: Which GUI concepts use polymorphism to establish
Q17: A parameter to a method can be
Q18: A polymorphic reference is one that can
Q19: The commitment to execute certain code to
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents