2016-07-11 87 views
1

我不知道爲什麼,編譯器錯誤指向字符串數組。我應該做一個for循環,並手動填寫每個下標與一年的月份名稱?請幫忙!!我不斷收到編譯器錯誤,說Rainfallmain.java:13:錯誤:<identifier>預計。

import java.util.*; 

public class Rainfallmain 
{ 
public static void main(String [] args) 
{ 
    double months = 12; 
    double average = Rainfallyr.getAverage(); 
    double Mostrain = Rainfallyr.getHighest(); 
    double Leastrain = Rainfallyr.getLowest(); 
    double total = Rainfallyr.getTotal(); 
    double [] Rainfallyr = new Rainfall[months]; 
    String[] Mon = {"January", "Febuary", "March", "April", "May", "June", "July", "August". "September", "October", "November", "December"}; 

    getRainvalues(Rainfallyr, mon); 

    System.out.println(" The total rainfall for the year is " + Mostrain); 
    System.out.println(" The total least aount of rain is " + Leastrain); 
    System.out.println(" The total rainfall for the year is " + total); 
    System.out.println(" The average rainfall for the year is " + average); 


} 


} 
    public static void getAllvalues(double []rain, String [] mon) 
    { 
     Scanner input = new Scanner(System.in); 
     for(int i = 0; i < r.length; i++) 
     { 
     System.out.print(" Enter Rain for each month" +mon[i]+" :"); 
     r[i] = input.nextDouble(); 


     } 




    } 
+0

你在什麼環境下編碼,它沒有指出那個時期? –

+0

你能推薦我一個IDE,這對於一個沒有經驗的程序員來說很難使用嗎? – alxanderapollo

回答

2
"August". "September" 

.需要隨後通過(被訪問的部件的名稱)的標識符的成員訪問運營商,而不是一個字符串。這就是爲什麼錯誤消息顯示「標識符預期」。

你可能打算在那裏使用逗號。