ファイルにデータを書き込みたいのですが、ここに私のコードがあります:
for (Season s : seasons) {
if (s.getYear() >= start && s.getYear() <= end) {
line += s.getYear() + ", " + s.getWinTeamName() + ", "
+ s.getMinorPremiersTeam() + ", "
+ s.getWoodenSpoonTeam()+ "\n"; }
}
System.out.println("File created.\n"); // Informing the user about
// the creation of the file.
out.write(line);
out.close();
私のファイルは作成されましたが、これは私が得たものです:
2005, Wests Tigers, Parramatta, Newcastle2006, Broncos, Storm, Rabbitohs
しかし、私はそれが欲しい:
2005, Wests Tigers, Parramatta, Newcastle
2006, Broncos, Storm, Rabbitohs
行変数の最後に「\n」を追加すると修正されると思いましたが、修正されていません。
それを修正する方法に関する提案はありますか?