PrintWriter pw = new PrintWriter(new FileOutputStream( new File("persons.txt"), true /* append = true */));
The true is the append mode flag.
Also check if you're using
pw.append(p.toString()); pw.append("sdf");
http://stackoverflow.com/questions/8210616/printwriter-append-method-not-appendinghttps://stackoverflow.com/questions/8210616/printwriter-append-method-not-appending