我正在制作一个简单的程序来输入一些数据(名称,游戏,成就分数和分钟数),每当我输入一个数据(最多100个)时,它只会记住输入的最后一个数据
https://i.gyazo.com/d4a51acc564fb459b9e590c7474700d8.png
我希望它记住列表中的所有条目
try
{
PrintWriter writer = new PrintWriter("Gamer Report Data.txt");
writer.println("Player : " + gamerName);
writer.println();
writer.println("--------------------------------");
writer.println();
String[] report = gamerReport.split(":");
writer.println("Game: " + report[0] + ", score= " +report[1] + ", minutes played= " +report[2]);
writer.close();
} catch (IOException e)
{
System.err.println("File does not exist!");
}
}
}
public static char[] getInput() {
return input;
}
public static void setInput(char[] input) {
JavaProject.input = input;
}
}