I am appending a file in scala, and I want to replace the last line of the file with a new text. I know how to append to a file, but I can't figure out how to overwrite the last line.
I am appending like this:
val fw = new FileWriter("src/file.txt", true) ;
fw.write("new item");
Could anybody help?