// File: file_io_append.java // // Author: Rahul Simha // Created: Aug 23, 1998 // // Illustrates appending to a file using the appropriate // FileWriter constructor. import java.io.*; public class file_io_append { public static void main (String[] argv) { try { // Using "true" as a second argument indicates "append" // in FileWriter. FileWriter fr = new FileWriter ("testdata_append", true); PrintWriter pw = new PrintWriter (fr, true); // Now we're ready for writing. pw.println ("Hello"); pw.println ("Hello again"); // Done. pw.close(); } catch (IOException e) { System.out.println (e); } } }