使用FileOutputStream将输出追加到文件
/** n o w j a v a . c o m - 时代Java 提 供 **/ import java.io.*; public class Main { public static void main(String[] args) { String strFilePath = "C://Folder//demo.txt"; try{ FileOutputStream fos = new FileOutputStream(strFilePath, true); String strContent = "Append output to a file example"; fos.write(strContent.getBytes()); fos.close(); } catch(FileNotFoundException ex)//来 自 nowjava - 时 代 Java { System.out.println("FileNotFoundException : " + ex); }