1
Well, I have a text file with a few lines, for you to understand better, here’s what I have in this file:
0
Zombie+160+-50
Zombie+160+290
Robot+-50+120
Spider+370+120
doors
1+BossRoom1
3+Loja1
Basically, I want to change that 0 to 1 while the program runs, what I did then is to use a Bufferedwriter and a Filewriter, but when I put the code:
bw.write("1");
It erases all the contents of my file and leaves only this 1 empty, there is some way that change only a few lines, not only the first, but others too, in case I have to change some other line in the future?
Full line recording for you to see how I did:
File file = new File("resources/Save/Room1.txt");
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write("1");
bw.close();