How to append data to a file?

You have to set the Stream to append mode like this:

pw = new PrintWriter(new FileWriter("d:\\stam\\stam.txt", true));

Leave a Comment