Posted on 2011-04-28
I want to know how I check in java if a file is already created (or) not ?
I have the following program.
FileWriter fstream = new FileWriter(filename);
out = new BufferedWriter(fstream);
when the loop repeats again, I dont want the file text.txt to be recreated every time.
I want to check if the file is already created add text to this file else create a new one.
Is there a way in JAVA to check if the file exists or not?
if it there , append to the file?
I want the FileWriter fstream = new FileWriter(filename);
to be inside the loop and not outside the loop.