我想用相同的数据同时写入2个不同的txt文件,但目前我可以覆盖一个文件,但另一个,帮助人们?
if (choice.charAt(0) == 'y' || choice.charAt(0) == 'Y'){
credits = 10;
System.out.println("Redeemed! Congratulations! $1.00 worth of credits have been added to your account.");
int finalpoints = points - credits;
try {
FileWriter fw = new FileWriter("Transaction.history",true);
fw.write(firstname + ";" + Integer.toString(finalpoints) + ";" + "$1.00" + ";" + dateToPrintToFile + "\r\n");
fw.close();
}catch (IOException ee){
System.out.println("Input file not found!");
}
//int finalpoints1 = points - credits;
try {
FileWriter fw = new FileWriter("Points" , true);
fw.write(firstname + ";" + Integer.toString(point -credits));
fw.close();
}catch (IOException ee){
System.out.println("Input file not found!");
}
}