import java.io.*; class WriteToFileAppend { public static void main (String args[]) { WriteToFileAppend wtfa = new WriteToFileAppend(); wtfa.fileWithAppend(); System.out.println("-----*----New text has been written into the existing file successfully----*-----"); } public void fileWithAppend() { FileWriter fw = null; BufferedWriter bw = null; try { fw = new FileWriter("appenToFile.txt", true); bw = new BufferedWriter(fw); bw.write("These text are newly added."); } catch(Exception e) { System.out.println(e); } finally { if (bw != null) try { bw.close(); } catch (IOException ioe) { System.out.println(ioe); } } } }