Consider the following class hierarchy:
public class Vehicle { private String type; public Vehicle(String type) { this.type = type; System.out.print("Vehicle "); } public String displayInfo() { return type; } } public class LandVehicle extends Vehicle { public LandVehicle(String type) { super(type); System.out.print("Land "); } } public class Auto extends LandVehicle { public Auto(String type) { super(type); System.out.print("Auto "); } }
When an object of type Auto is constructed, what will be printed by the constructors from this inheritance hierarchy?
Vehicle Land Auto Vehicle Land Auto Auto Land Vehicle Auto Land Vehicle Land Auto Vehicle Land Auto Vehicle Auto Auto Skip to navigation