Consider the following code snippet:
Public class Vessel
{
Private String manufacturer;
) . .
Public void setVesselClass(double engineRPM)
{
) . .
}
}
If a Speedboat class is created as a subclass of the Vessel class, which of the following statements is correct?
A) A Speedboat object inherits and can directly use both the instance variable manufacturer and the method setVesselClass.
B) A Speedboat object inherits and can directly use the instance variable manufacturer but not the method setVesselClass.
C) A Speedboat object inherits but cannot directly use either the instance variable manufacturer or the method setVesselClass.
D) A Speedboat object inherits and can directly use the method setVesselClass but cannot directly use the instance variable manufacturer.
Correct Answer:
Verified
Q27: Which reserved word must be used to
Q32: Consider the following code snippet:
Public class Vehicle
{
)
Q35: Consider the following code snippet:
Public class Vehicle
{
)
Q36: If a subclass defines the same method
Q38: Consider the following class hierarchy:
Public class Vehicle
{
Private
Q39: Consider the following code snippet:
Public class Employee
{
)
Q40: Consider the following code snippet:
Public void deposit(double
Q41: Consider the following class hierarchy:
Public class Vehicle
{
Private
Q42: Consider the following code snippet:
Public abstract class
Q56: To override a superclass method in a
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