Consider the following code snippet:
Public class Vehicle
{
Private String manufacturer;
) . .
Public void setVehicleClass(double numberAxles)
{
) . .
}
}
If a Motorcycle class is created as a subclass of the Vehicle class, which of the following statements is correct?
A) A Motorcycle object inherits and can directly use both the instance variable manufacturer and the method setVehicleClass.
B) A Motorcycle object inherits and can directly use the instance variable manufacturer but not the method setVehicleClass.
C) A Motorcycle object inherits but cannot directly use either the instance variable manufacturer or the method setVehicleClass.
D) A Motorcycle object inherits and can directly use the method setVehicleClass but cannot directly use the instance variable manufacturer.
Correct Answer:
Verified
Q1: You are creating a class inheritance hierarchy
Q12: Consider the following inheritance hierarchy diagram:
Q20: Insert the missing code in the following
Q24: You are creating a Motorcycle class which
Q26: Which of the following is true regarding
Q27: You are creating a Motorcycle class that
Q30: Which of the following indicates that the
Q35: Which of the following is true regarding
Q39: Which of the following indicates that a
Q50: If a subclass contains a method with
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