2017-09-19 142 views
-3

私は学校でプロジェクト用のコードを設計しています。次のコードをコンパイルするときに唯一のエラーコードがトークン "return"の構文エラーです。トークン "return"の構文エラー、予期されるバイト

static public int getMonthlyTotal(){ 
    //Calulates utilities 
    int monthlyTotal = 0; 
    //Define imput streams 
    InputStreamReader input = new InputStreamReader(System.in); 
    BufferedReader reader = new BufferedReader(input); 

    monthlyTotal = (150 + 60 + 20 + 60 + 800); 
} 
return monthlyTotal; 
+0

'monthlyTotalを返す見詰める;(あまりにも前に1行)' –

+1

スワップ最後の2行、すなわち。 '}'の前に 'return'を移動してください。 – dave

答えて

0
static public int getMonthlyTotal(){ 
    //Calulates utilities 
    int monthlyTotal = 0; 
    //Define imput streams 
    InputStreamReader input = new InputStreamReader(System.in); 
    BufferedReader reader = new BufferedReader(input); 

    monthlyTotal = (150 + 60 + 20 + 60 + 800); 
    return monthlyTotal; 

} 
関連する問題