我有这段代码:
try {
File file = new File("newbook.txt");
FileWriter fw = new FileWriter(file, true);
BufferedWriter out = new BufferedWriter(fw);
if (!file.exists()) {
file.createNewFile();
}
for (int r = 0; r < StuGrades.length; r++) {
for (int c = 0; c < StuGrades[0].length; c++) {
//out.write(StuGrades[r][c]);
out.write(" " + StuGrades[r][c]);
}
}
}catch(IOException e){
System.out.println("something's wrong");
}
它不会运行任何错误,但它不会在txt中写入任何内容。