io流
代码如下(示例):
public static void text(ArrayList<Students>array)throws IOException{
BufferedWriter bw=new BufferedWriter(new FileWriter("D:\\javawork\\学生管理系统\\student.txt"));
for(Students w:array){
StringBuilder sb =new StringBuilder();
sb.append(w.getId()).append(",").append(w.getName()).append(",").append(w.getMath()).append(",").append(w.getChinese());
bw.write(sb.toString());
bw.newLine();
bw.flush();
}
bw.close();
}
结果
请从java学生管理系统(一)看起