Java examples for File Path IO:FileOutputStream
Append output to file using FileOutputStream
import java.io.*; public class Main { public static void main(String[] args) { /*ww w .j a va 2s.c o m*/ 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) { System.out.println("FileNotFoundException : " + ex); } catch(IOException ioe) { System.out.println("IOException : " + ioe); } } }