I want to write some data to a file and here is my code:
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();
My file is created but this is what I get:
2005, Wests Tigers, Parramatta, Newcastle2006, Broncos, Storm, Rabbitohs
But I want it to be:
2005, Wests Tigers, Parramatta, Newcastle
2006, Broncos, Storm, Rabbitohs
I thought the adding the "\n" at the end of the line variable would fix that but it hasn't.
Any suggestions on how to fix that?