这是我在父类@覆盖Java的父类
public boolean ChoiceOfItem(){
if (bread)
this.Choice("bread");
if (meat)
this.Choice("meat");
if (lettuce)
this.Choice("lettuce");
if (tomato)
this.Choice("tomato");
if (carrot)
this.Choice("carrot");
return false;
}
代码,这一个是从扩展(不父)类:
@Override
public boolean ChoiceOfItem() {
if (ryeBread)
this.Choice("ryeBread");
return false;
}
我的问题是什么错在哪里? 期待您的消息。如果有必要,我将能够发送整个代码。
那么......“什么是错的” - 你告诉我们!你的问题是什么? – Marvin
你应该在扩展类中调用'return super.ChoiceOfItem()'而不仅仅是false –
你应该编辑这个问题并至少提供:1)代码的预期结果是什么(你想要达到什么目的? )2)代码的实际结果是什么(会发生什么,为什么会出错?) 否则,您可能会在问题关闭时结束。 –