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
Q1: You are creating a class inheritance hierarchy
Q21: You are creating a Motorcycle class which
Q22: What must a subclass do to modify
Q23: To create a subclass, use the _
Q24: You are creating a Motorcycle class which
Q26: Which of the following is true regarding
Q27: You are creating a Motorcycle class that
Q29: Which of the following is true regarding
Q29: Consider the following class hierarchy: public class
Q30: Which of the following indicates that the
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