Insert the missing code in the following code fragment. This fragment is intended to call the Vehicle class's method. public class Vehicle { . . . public void setVehicleClass(double numberAxles) { . . . } } public class Motorcycle extends Vehicle { . . . public Motorcycle() { _______________; } }

Respuesta :

Answer:

The answer is D.

Explanation:

The question is incomplete, here is the full question;

Insert the missing code in the following code fragment. This fragment is intended to call the Vehicle class's method.

public class Vehicle

{

. . .

public void setVehicleClass(double numberAxles)

{

. . .

}

}

public class Motorcycle extends Vehicle

{

. . .

public Motorcycle()

{

_______________;

}

}

a) Motorcyle.setVehicleClass(2.0);

b) Vehicle.setVehicleClass(2.0);

c) this.setVehicleClass(2.0);

d) setVehicleClass(2.0);

According to the information and the code snippet given in the question, the correct answer to fill in the blank should be D,  setVehicleClass(2.0); because it is in the Motorcycle class which "extends" vehicle meaning that it's a subclass.

I hope this answer helps.