我有一个具有 4 个 int 值的 nonvoid 方法,但我只想“返回”其中一个 int 值。我在调用“calcpoints(final_points).
需要错误:int、int、int、int 找到:int 原因:实际参数列表和形式参数列表的长度不同
我的代码:
public static int calcpoints (int points, int total_points, int answer, int correct) {
while ((points >= 0) && (answer != correct)) {
System.out.println("Display problem");
answer = GetInput.readLineInt();
if (answer == correct) {
total_points = total_points + points;
} else {
points = points / 2;
}
total_points = total_points + points;
}//end of while loop points
return (total_points);
}//end of the calculate points method