时间:2020-10-16 12:55:02 | 栏目:JAVA代码 | 点击:次
实例如下所示:
private static String savefile = "E:\\test.txt"; private static void saveAsFileWriter(String content) { FileWriter fwriter = null; try { fwriter = new FileWriter(savefile); fwriter.write(content); } catch (IOException ex) { ex.printStackTrace(); } finally { try { fwriter.flush(); fwriter.close(); } catch (IOException ex) { ex.printStackTrace(); } } }