Trouble with filewriter overwriting files instead of appending to the end

后端 未结 3 1934
孤城傲影
孤城傲影 2020-11-28 15:00

OK, I\'m having some trouble writing multiple lines to a text file.

the program runs, but it won\'t use new lines each time

when I want it run 4 times, the t

3条回答
  •  独厮守ぢ
    2020-11-28 15:46

    By default FileWriter will overwrite the file. What you might want to do is define the reader in the following manner:
    new FileWriter("encoded.txt", true)
    This way the file will be appended to instead of being overwritten.

    Hope this helps!

提交回复
热议问题