Avatar of Christopher Schene
Christopher Schene
Flag for United States of America

asked on 

How do I append to a file in java?

This code I am using creates an empty file each time and thus my file contains only 1 line all the time.

What I would like to do is append to the file if it exists or create it and append if it does not exist.

private  void saveToLogFile(String s) throws FileNotFoundException {  
        PrintWriter pw=new PrintWriter(myLoggerFile);


Avatar of undefined
Last Comment

8/22/2022 - Mon