我不斷收到這個錯誤,但我不知道是什麼造成它,請問有人能幫我理解嗎?Java數組錯誤「數組需要但int找到」
private int [] arrayFeeCode = new int [5];
/**
* Constructor for objects of class Rally
*/
public Rally(int RC, String Venue, int NumDays, int MaxPlaces, int arrayFeeCode)
{
// initialise instance variables
arrayFeeCode[0] = 0.00;
arrayFeeCode[1] = 10.00;
arrayFeeCode[2] = 15.50;
arrayFeeCode[3] = 17.75;
arrayFeeCode[4] = 20.00;
}
像@Legend說,你的方法簽名是不正確的 – VirtualTroll 2013-03-22 14:42:10
實際上,R從您的構造函數參數列表中刪除'arrayFeeCode'變量。因爲'arrayFeeCode'被聲明爲一個實例變量,所以你不需要它作爲構造函數參數。 – PermGenError 2013-03-22 14:42:55
你真的需要在你的構造函數中,它似乎是一個實例變量? – 2013-03-22 14:43:21