Well, I have a text file with a few lines, for you to understand better, here is 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, however when I put the code:
bw.write("1");
It deletes all the contents of my file and leaves only 1 in the blank, is there any way I can change only a few lines, not only the first but also others, in case I have to change some other line in the future? p>
Complete recording line for you to see how I did it:
File file = new File("resources/Save/Room1.txt");
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write("1");
bw.close();