File Editing In Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

File Editing In Java

I have a Program That Takes User Input as A String And Adds That Data To A Text File. However When I Use The File Writer The Initial Contents of The File Are Overridden By The New String. Is There A Way To Add Data To The File Without Previous Data Being Sweeped Off ?

8th Dec 2017, 2:55 PM
Aayush Bhansali
Aayush Bhansali - avatar
2 Answers
+ 3
public FileWriter(String fileName, boolean append) if append is new content is added at the end
9th Dec 2017, 12:09 AM
Mario
+ 4
Works 😊
9th Dec 2017, 6:40 AM
Aayush Bhansali
Aayush Bhansali - avatar