实例如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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(); } } } |
以上这篇java 实现将一个string保存到txt文档中就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
原文链接:https://blog.csdn.net/baoyan2015/article/details/53203370
查看更多关于java 实现将一个string保存到txt文档中的详细内容...