0

I have tried \n and stuff its still not working..? I have also tried System.lineSeparator(); it still does not work. I have reviewed other posts.

FileWriter myWriter = new FileWriter("Random.txt");
myWriter.write(saltStr);
myWriter.close();

Yes, I have looped the file writer.

Output file:

2TFPXDLDKSFZUCIP5FGUAXZU
RG2N
  • 17
  • 6
  • 3
    Does this answer your question? [Create a new line in Java's FileWriter](https://stackoverflow.com/questions/18549704/create-a-new-line-in-javas-filewriter) – ATP Feb 23 '21 at 18:59
  • `FileWriter fileWriter = new FileWriter(fileName, true);` this is all what you want – Faramarz Afzali Feb 23 '21 at 19:09

1 Answers1

2

Just add new line symbol:

myWriter.write("\n");

Or system dependent from System.lineSeparator(), but \n will always work.

Oleg Cherednik
  • 17,377
  • 4
  • 21
  • 35