Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Overwrite file using BufferedWriter

807598Sep 30 2006 — edited Oct 2 2006
I am using BufferedWriter in my in following way:
BufferedWrite out = new BufferedWriter(new FileWriter(filename));

and then i'm writing to the file using out.write;

but everytime run the program, the text gets appended to the file, while I want overwrite the existing file and then write to it.

How do I do this??
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2006
Added on Sep 30 2006
3 comments
2,988 views