Question: 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
Get step-by-step solutions from verified subject matter experts
