I am currently making an application where the user can add multiple accounts. The login information is being stored in a text file. I need a way for the user to add a new account without BufferedWriter overwriting the other accounts' information. Any suggestions?
package mainFiles.fileManagers;
import java.io.*;
public class NewTXT {
public static void nFile( String a , String b ) throws IOException {
File f = new File("mainFiles\\storage\\accountinfo.txt");
FileWriter writer = new FileWriter("mainFiles\\storage\\accountinfo.txt");
BufferedWriter bWriter = new BufferedWriter(writer);
f.createNewFile();
f.canWrite();
bWriter.newLine();
bWriter.write(a + "?" + b );
bWriter.newLine();
bWriter.close();
}
}