i want to write string content to the end of the text file
Then just use the overload of the FileWriter
constructor that takes an append
flag:
FileWriter fw = new FileWriter("C:/Users/Ashad/Desktop/text.txt", true);
Personally though, I'd prefer to use FileOutputStream
and an OutputStreamWriter
- that way you can specify the encoding.