how can i write java output in text file continuously

java

Solution

If using `FileWriter` , pass true as a second argument to FileWriter to turn on "append" mode.

fout = new FileWriter("filename.txt", true);

FileWriter usage reference

Problem

I tried to get the output of java program as a text file.but when i print output in a text file and for the next set of input it overwrites on it.I want to see all of my output in an order in a text file.How can I?

Original source