我最近在java中使用了一些OOP課程。在今天實施它時,我在我的程序中遇到了「無法找到符號」錯誤。在它所說的一面的建議中,「預期的表達」。我一直在試圖弄清楚我的錯誤,但到目前爲止沒有碰到我。有人可以幫我嗎?「預期的表達式」和「找不到符號」錯誤
這是我的主類:
public class Slotmachine {
public static void main(String[] args) {
int plays;
SlotMac machine[] = new SlotMac[3];
// error seems to be somewhere here!
SlotMac[0] = new SlotMac(3,35,30);
SlotMac[1] = new SlotMac(10,100,60);
SlotMac[2] = new SlotMac(4,10,9);
plays = machine.firstmachine(machine[0]);
}
}
我的其他類:
public class SlotMac {
int win_plays;
int times_played;
int quarters;
public SlotMac(int times_played, int win_plays, int quarters) {
this.win_plays = win_plays;
this.times_played = times_played;
this.quarters = quarters;
}
public int firstmachine(SlotMac one) {
return plays;
}
}
的java:找不到符號 符號:類SlotMac 位置:類Slotmachine
同樣的錯誤一堆的時間。
不要發佈重複的問題,編輯你問這裏的一個HTTP導入類://stackoverflow.com/questions/23532713/cannot-find-symbol-error-when-compiling/23532749#23532749 –