内调用父类方法,我有一个类Mouse
扩展类Mammal
。在Mouse
,我有这需要在作为参数Mouse
的ArrayList
的目的,这样的静态方法:麻烦从子类的静态方法
public static void mate(ArrayList<Mouse> mice)
这里面静态方法,我有这行代码:
if((mice.get(i).getIsMale^mice.get(j).getIsMale) && (mice.get(i).getAge > 1) && (mice.get(j).getAge > 1))
//if either mouse is male but not both and if both are older than 1 day
其中getIsMale
和getAge
是在超类中定义的哺乳动物的方法i
,并和j
是变量我静态mate
方法内使用。
我从上面行的编译器4个错误:无法找到象征。每个getIsMale
一个getAge
我会很感激任何(快速)的帮助。我必须提交这份任务并入睡。谢谢!
+1也提出了布尔getter命名约定。 ;-)(实际上我比你更快地提高了你的速度,但这恰好是我的一个秘密,所以当其他人强化这一点的时候,它很好。:-)) –
上帝,我一直在挠挠我的头,这么长时间试图找出什么是错的,而支架没有发生,我在所有。谢谢你的回复! –