Consider the following code snippet: Vehicle aVehicle = new Auto(); aVehicle.mov
ID: 3642740 • Letter: C
Question
Consider the following code snippet:
Vehicle aVehicle = new Auto();
aVehicle.moveForward(200);
If the
Auto
class inherits from the
Vehicle
class, and both classes have an implementation of the
moveForward
method, which statement is correct?
Answer
a.
The
moveForward
method of the
Auto
class will be executed.
b.
The
moveForward
method of the
Vehicle
class will be executed.
c.
You must specify in the code which class's
moveForward
method is to be used..
d.
It is not possible to determine which class it's method is called.
Explanation / Answer
(b)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.