public void ArrayListToFile() {
FileWriter out=null;
BufferedWriter bw=null;
try {
file=new File(this.getClass().getResource("/data/classmatesdata.txt").toURI());
                           //这里file的路径有问题,应该如何去写啊
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
try {
out=new FileWriter(file);
bw=new BufferedWriter(out);
Iterator<Classmate> it=classmateList.iterator();
while(it.hasNext()) {
Classmate classmate=it.next();
...
                                    ...
}
bw.flush();
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}