毕老师代码- public static void wirte2File(Set<student> stus) throws IOException
- {
- BufferedWriter bufw = new BufferedWriter(new FileOutputStream("stuinfo.txt"));
-
- for ( Student stu : stus )
- {
- bufw.write(stu.toString() + "\t");
- /*为何此处改成bufw.write(stu.getSum() + “”);则不会再有乱码?*/
- bufw.write(stu.getSum());
- bufw.newLine();
- bufw.flush();
- }
- }
复制代码 |
|