令牌上的语法错误"返回",字节预期

时间:2017-09-19 22:57:38

标签: java

我正在为学校的项目设计一个代码,并且在编译以下代码时我得到的唯一错误代码是令牌上的语法错误"返回",字节预期。

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;

1 个答案:

答案 0 :(得分: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;

}