如何在文件中使用追加功能
答
您应该使用FileWriter(File file, boolean append)
构造函数的布尔值true
。
例
File file = new File("c:/tmp/foo.txt");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
pw.println("Hello, World");
pw.close();
http://stackoverflow.com/questions/2738448/java-io-how-to-append-to-an-already-existing-text-file已经回答 – Poindexter 2010-06-01 16:34:05