I am using FileOutputStream for writing some data to a file. Every time I execute my program, it appends the data to existing file instead of creating new one. I want to create a new file every time I execute the program. How do I do that?
Share
It doesn’t append by default. It will only append when you use the constructor of
FileOutputStreamtaking a boolean argument wherein you passtrue. Just remove it.In a nut, don’t do
but rather do