Text file over written
I am trying to learn file handling in Java. I want to append text to the end of a file and tried following script:
But the text file is overwritten. I know I can use RandomAccessFile to point to end of file and then append. Is this possible with BufferedWriter?
BufferedWriter out = new BufferedWriter(new FileWriter("C:\\myFile.txt"));
The FileWriter class api shows a couple of constructors that take a boolean append argument. You can find out what they do in the Constructor Detail section.
Thanks hardwired. It worked.
public FileWriter(String fileName,boolean append) throws IOException