Here you can find the source of appendFile(String filename, String text)
public static void appendFile(String filename, String text) throws IOException
//package com.java2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Main { public static void appendFile(String filename, String text) throws IOException { PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter(filename, true))); out.println(text);//from ww w . j a v a2 s . com out.close(); } public static void appendFile(File f, String text) throws IOException { PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter(f, true))); out.println("the text"); out.close(); } }