IO流7 --- FileWriter写出数据的操作 --- 技术搬运工(尚硅谷)
作者:互联网
- FileWriter字符输出
@Test public void test3(){ File file = new File("hello1.txt"); FileWriter fw = null; try { //自动创建文件。默认false,覆盖写;true追加写 fw = new FileWriter(file, true); fw.write("天南地北"); } catch (IOException e) { e.printStackTrace(); }finally { if (fw != null){ try { fw.close(); } catch (IOException e) { e.printStackTrace(); } } } }
标签:IO,fw,printStackTrace,file,new,FileWriter,搬运工,null 来源: https://www.cnblogs.com/noyouth/p/11699280.html