Consider the following code snippet: public class Vehicle { private String vehic
ID: 3642808 • Letter: C
Question
Consider the following code snippet:
public class Vehicle
{
private String vehicleColor;
. . .
public void setVehicleAtrributes()
{
. . .
}
}
public class Auto extends Vehicle
{
private String vehicleColor;
. . .
public void setVehicleAtrributes()
{
. . .
}
}
Which of the following statements is correct?
Answer
a.
The subclass is shadowing a superclass variable.
b.
The subclass is overloading a superclass variable.
c.
The subclass is overriding a superclass variable.
d.
This code will not compile.
Explanation / Answer
(a)
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.