Why is the following code, which assumes ChoiceQuestion is a subclass of Question, considered poor strategy?
A) Question should be the subclass, not the other way around.
B) instanceof is not an operator but rather a method.
C) instanceof should not be used for type tests that can be solved by using polymorphism.
D) the instanceof reserved word should only be used in a class constructor.
Correct Answer:
Verified
Q76: Which of the following is true regarding
Q77: Suppose the abstract class Message is defined
Q78: Consider the following code snippet:
Q79: Which of the following statements about classes
Q80: Which of the following statements about classes
Q82: To test whether an object belongs to
Q83: When you implement equals in a subclass,
Q84: Consider the following code snippet:
Q85: Consider the Counter class below.
Q86: Consider the following code snippet, which is
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