今天又重回HFJ,上次退出時沒解決的問題解決了,其實是很小的問題,記錄如下:
在Chapter6中,對上一章的dotcom遊戲進行改進,書中源碼輸入後,
for(DotCom dotComToSet :dotComsList){
ArrayList<String> newLocation=helper.placeDotCom(3);
//ArrayList<String> newLocation =helper.placeDotCom(3);
dotComToSet.setLocationCells(newLocation);
}
提示DotComBust.java中有錯誤:The method placeDotCom(int) is undefined for the type GameHelper,即GameHelper類中的方法placeDotCom()沒定義。
查了一圈,後來發現鼠標停在helper上有提示框
我每個章節的代碼放在不同的chaper包裏,但是全在HFJ的project下,這個help識別到chapter5中的同名GameHelper中了。
更改類名即可解決。