我正在使用制作一个简单的高分系统代码 - Codecall,但我在使用它时收到错误.导致问题的一行是在HighScoreManager()课堂内.
这是错误的代码:
public String getHighscoreString() {
String highscoreString = "";
Static int max = 10; // this line gives an error
ArrayList<Score> scores;
scores = getScores();
int i = 0;
int x = scores.size();
if (x > max) {
x = max;
}
while (i < x) {
highscoreString += (i + 1) + ".\t" + scores.get(i).getNaam() + "\t\t" + scores.get(i).getScore() + "\n";
i++;
}
return highscoreString;
}
Run Code Online (Sandbox Code Playgroud)
线路Static int max = 10; …