Question: 19-21 please include explanation Consider the following code snippet: public class Motorcycle extends Vehicle {public Motorcycle (int number Axles) super (numberAxles);//line #1}} If the line
19-21 please include explanation
Consider the following code snippet: public class Motorcycle extends Vehicle {public Motorcycle (int number Axles) super (numberAxles);//line #1}} If the line marked "//line #1" was missing, which of these statements would be correct? a. The Motorcycle class constructor would invoke the constructor of the Vehicle class with no parameters. b. The Vehicle class constructor would invoke the constructor of the Motorcycle class with no parameters. c. The Motorcycle class constructor would invoke the constructor of the Vehicle class with a parameter value of 0. d. This code would not compile. Consider the following code snippet: Employee anEmployee = new Programmer(); anEmployee.increaseSalary (2500); Assume that the Programmer class inherits from the Employee class, and both classes have an implementation of the increaseSalary method with the same set of parameters and the same re type. Which class's increaseSalary method is to be executed is determined by ___. a. the hierarchy of the classes b. the variable's type. c. the actual object type. d. it is not possible to determine which method is executed. Which of the following statements about comparing objects is correct? a. The equals method and the == operator are perform the same actions. b. The == operator is used to compare whether two objects have the same contents. c. The equals method is used to compare whether two references are to the same object. d. The equals method is used to compare whether two objects have the same contents
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
