Examlex

Solved

Consider a Class Hierarchy That Includes a Class Called Vehicle

question 12

Essay

Consider a class hierarchy that includes a class called Vehicle, with subclasses called Car and Airplane. The Vehicle class has a method called getMaxSpeed, which is overridden in the Car class. The getMaxSpeed of the Vehicle class returns 760 mph, while the getMaxSpeed method of the Car class is overridden to return 150 mph. What is the output of the following snippet of code? Explain your answer.
Vehicle v = new Car();
System.out.println(v.getMaxSpeed() + " mph");


Definitions:

Linear Perspective

A form of perspective in art and drawing where parallel lines converge at a single point on the horizon to create the illusion of depth on a flat surface.

Depth Perception

The ability to perceive the visual world in three dimensions and to judge the distance of objects.

Clairvoyance

The supposed ability to gain information about an object, person, location, or physical event through means other than the known human senses.

Precognition

The alleged psychic ability to see or know about events before they happen.

Related Questions