我在我的数组列表中进行了一些更改。在我想从我的数组列表中写入一个txt文件后。但它只写onu线。我没有明白。我怎样才能写一个文件我arraylist?
我该如何解决?
这是我的代码
try {
show_seats_write = new PrintWriter(new FileOutputStream(new File("d:/seats2.txt"),true));
System.out.println("Tickets size: "+tickets.size());
for(int i=0;i<tickets.size();i++){
for(int j=0;j<tickets.get(i).getlist().size();j++){
show_seats_write.print(tickets.get(i).getlist().get(j));
System.out.print(tickets.get(i).getlist().get(j));
System.out.println();
show_seats_write.println();
show_seats_write.close();
}
}
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
谢谢。你救了我的命 :) – user3717742