public class Vegetable {
private int calories;
public Fruit (int calories){
this.calories = calories;
}
}
public class Onion extends Vegetable {
private String color;
public Onion (int calories, String color) {
super(calories);
color = color;
}
}
Why doesn’t Onion constructor method properly set the color?
A. The Vegetable class’ calories attribute is private so the call to super doesn’t work.
B. The onion class’ color attribute is private, so it cannot be changed.
C. The constructor’s color variable hides Onion's color attribute so the wrong variable is changed.
D. The call to super doesn’t include the color.
Update: Please explain why you have chosen what you did?
I think the answer should be D but i'm confused?