TD.A pose a elass Car and its subelass Honda both have a method called speed as
ID: 3726620 • Letter: T
Question
TD.A pose a elass Car and its subelass Honda both have a method called speed as part of the elass code: rentalH refers to an object of the type Honda and the follewing statements are tou rental1H.costo super-speed ( ) 84. In the scenario described above, what will the first statement do? a. The cost method in Honda will be called. b. The cost method in Car will be called o. Nothing will be called since the code will not compile as a result of multiple definitions of speed. d. Overloading will be used to determine which cost method to use. In the scenario described above, what will the second statement do? a- 85. The speed method in Honda will be called. The speed method in Car will be called. b. c. Nothing will be called since the code will not compile as a result of multiple definitions of speed. Overloading will be used to determine which method of speed to use. which of the following statements about the reference super is true? a. It must be used every time a method from the superclass is called. b. It must be the last statement of the subclass constructor c. It must be the first statement of the subclass constructor d. It can only be used once in a program. d. -86.Explanation / Answer
SOLUTIONS:-
(84):- (a) cost method in Honda will be called.
REASON:- because rental.H is object of subclass Honda
(85):- (b) speed method in Car will be called
REASON:- because super is used here to call super class method
(86):- (c) It must be he first statements of the subclass constructor
(87):-(c) length
REASON:- because length belongs to sub class Rectangle
(88):-(b) overrides
REASON:- methods of super class can be overridden in subclass with same parameters.
(89):- (a) overloads
REASON:- methods of super class can be overloaded in subclass with different parameters.
(90):- (a) Object
REASON:- toString() method is defined by Object class. Object class is the super class of all objects in java.
======================================================================================
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.