Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Which of the following method declarations overrides this method? double calculateMilesPerGallon(double speed){...} a. double calculateMilesPerGallon(int speed){...} b. double calculateMilesPerGallon(double s){...} c. double calculateMilesPerGallon(double speed, int

Which of the following method declarations overrides this method?

double calculateMilesPerGallon(double speed){...}

a.

double calculateMilesPerGallon(int speed){...}

b.

double calculateMilesPerGallon(double s){...}

c.

double calculateMilesPerGallon(double speed, int r){...}

d.

double calculate(double speed){...}

Hierarchy 11-1

Vehicle

MotorVehicle WaterCraft

Automobile Motorcycle Sailboat Canoe

(Refer to inheritance hierarchy 11-1.) If the constructor that follows is called, it calls a constructor from which class?

public Sailboat(int sails) {

super();

this.sails = sails;

}

a.

Sailboat

b.

Canoe

c.

WaterCraft

d.

Vehicle

(Refer to inheritance hierarchy 11-1.) If the MotorVehicle class contains a protected method named getEngineType, what other class or classes can access this method?

a.

Vehicle, Automobile, and Motorcycle

d.

Vehicle

b.

Vehicle and WaterCraft

e.

no other classes can access it

c.

Automobile and Motorcycle

If the Point class doesnt override the equals method in the Object class, what will the following code do?

Point pointOne = new Point(3, 4);

Point pointTwo = new Point(3, 4);

System.out.println(pointOne.equals(pointTwo));

a.

Cause a compile-time error since the equals method doesnt exist in the Point class

b.

Cause a compile-time error since the equals method cant accept a Point object

c.

Print true to the console

d.

Print false to the console

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions