Multiple Choice
Suppose that the class Mystery is derived from the class Secret. Consider the following statements. Secret mySecret = new Secret() ; Secret secRef; Mystery myMystery = new Mystery() ; Mystery mysRef; secRef = myMystery; Which of the following statements is legal in Java? (i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef;
A) Only (i)
B) Only (ii)
C) Both (i) and (ii)
D) None of these
Correct Answer:

Verified
Correct Answer:
Verified
Q1: The superclass inherits all its properties from
Q2: To determine whether a reference variable that
Q3: Consider the following class definitions. public class
Q4: A subclass can override public methods of
Q6: Suppose that the class Mystery is derived
Q7: A subclass inherits all its data members
Q8: The classes Reader and Writer are derived
Q9: In Java, stream classes are implemented using
Q10: If a class implements an interface, it
Q11: Interfaces are defined using the reserved word