Examlex

Solved

Consider the Following Class Hierarchy: Public Class Vehicle

question 4

Multiple Choice

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.


Definitions:

Tags

Labels or keywords assigned to information or data, which help in categorizing and easily searching for items.

Access Table

A table in Microsoft Access where data is stored in rows and columns, each table defines a set of fields (columns) for a specific type of data.

Query Results

The data retrieved from a database or information system in response to a specific query.

HTML Document

A document written in HyperText Markup Language that defines the structure and layout of information on a webpage.

Related Questions