2.向文件中写入文本
BufferedWriter out = null; try { out = new BufferedWriter(new FileWriter("filename", true)); out.write("aString"); } catch (IOException e) { // error processing code } finally { if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } }