Asked by Caitlyn Hopkins on Jul 07, 2024
Verified
Suppose that the class Mystery is derived from the class Secret. The following statements are legal in Java.Secret secRef;
Mystery mysRef = new Mystery();
secRef = mysRef;
Legal
Pertaining to the system of laws within a particular country, state, or community.
Superclass
A class from which other classes inherit methods and variables; also known as the parent class.
- Understand the employment and guidelines of polymorphism in the context of Java programming.
- Gain insight into the rudimentary mechanisms of inheritance in Java.
Verified Answer
ZK
Zybrea KnightJul 09, 2024
Final Answer :
True
Explanation :
Since a derived class object can be treated as a base class object, it is legal to assign a Mystery object to a Secret reference variable.
Learning Objectives
- Understand the employment and guidelines of polymorphism in the context of Java programming.
- Gain insight into the rudimentary mechanisms of inheritance in Java.
Related questions
A Polymorphic Reference Variable Can Refer to Either an Object ...
Any New Class You Create from an Existing Class Is ...
If a Class Is Declared Final, Then No Other Class ...
What Is the Correct Syntax for Defining a New Class ...
Whenever There Is a Superclass-Subclass Relationship, the Superclass Inherits All ...