Your code works fine for me. It replaced the text in the file as expected and didn’t append.
If you wanted to append, you set the second parameter in
new FileWriter(fnew,false);
to true;
Your code works fine for me. It replaced the text in the file as expected and didn’t append.
If you wanted to append, you set the second parameter in
new FileWriter(fnew,false);
to true;