下面的法典是我目前掌握的,但当时它超越了卷宗中的任何数据,而不是把数据放在最后。 这样做是否容易?
public void printCustomerList() throws IOException{
FileWriter pw = new FileWriter("F:\data.csv");
Iterator s = customerIterator();
if (s.hasNext()==false){
System.out.println("Empty");
}
while(s.hasNext()){
Customer current = (Customer) s.next();
System.out.println(current.toString()+"
");
pw.append(current.getName());
pw.append(",");
pw.append(current.getAddress());
pw.append("
");
}
pw.flush();
pw.close();
}