I suppose to write the records to a text file. However every time i re-log in and add a record.The previous record will be rewrite. >.<''
public void addRecords(){
getInfo();
FileWriter fWriter = null;
BufferedWriter writer = null;
try {
fWriter = new FileWriter("PassengerInfo.txt");
writer = new BufferedWriter(fWriter);
writer.write(name);
writer.write(";");
writer.write(phone);
writer.write(";");
writer.write(nationality);
writer.write(";");
writer.write(IC);
writer.newLine();
writer.close();
}catch (IOException e) {
JOptionPane.showMessageDialog(null,"FILE NOT EXIST");
}
}
Are there any way to keep the record?