// File: FileIOAppend.java // // Author: Rahul Simha // Created: Aug 23, 1998 // // Illustrates appending to a file using the appropriate // FileWriter constructor. import java.io.*; public class FileIOAppend { 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); // Now we're ready for writing. pw.println ("Hello"); pw.println ("Hello again"); // Done. pw.close(); } catch (IOException e) { System.out.println (e); } } }