Consider the following class hierarchy: public class Vehicle { private String type; public Vehicle(String type) { this.type = type; } public String displayInfo() { return type; } } public class LandVehicle extends Vehicle { public LandVehicle(String type) { super(type); } } public class Auto extends LandVehicle { public Auto(String type) { super(type); } } You have written a program to use these classes, as shown in the following code snippet: public class VehicleTester { public static void main(String[] args) { Auto myAuto = new Auto("sedan"); System.out.println("MyAuto type = " + ______); } } Complete the code in this program snippet to correctly display the auto's type. a) myAuto.displayInfo() b) myAuto.super.displayInfo() c) myAuto.super.super.displayInfo() d) This cannot be done unless the Auto class overrides the displayInfo method.

Respuesta :

It can be said that  the code in this Program Snippet to correctly display the Auto's type we have

  • "myAuto.displayInfo()"

Option A

Writing Complete Programs

Generally As we see right here superclass technique displayinfo() is declared as public. So all the subclasses can get admission to the approach directly.

Having Auto is subclass of Vehicle (because LandVehicle is subclass of Vehicle and Auto is subclass of LanVehicle), Auto variable can immediately get admission to the method.

Therefore

"myAuto.displayInfo()" is the corresponding Code

Option A

For more information on Code visit

https://brainly.com/question/497311