logo

Crowdly

Consider the following class hierarchy: public class Vehicle {    private St...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

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. 

100%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.lsu.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!