当前位置: 移动技术网 > IT编程>开发语言>Java > java 文件续写

java 文件续写

2020年04月10日  | 移动技术网IT编程  | 我要评论
public class filewriterdemo {
    public static void main(string[] args) {
        filewriter fw = null;
        try {
            // 传递true,代表不覆盖已有文件,追加
            fw = new filewriter("demo.txt", true);
            fw.write("abcde\n");
        } catch (ioexception e) {
            system.out.println(e.tostring());
        } finally {
            try {
                if (fw != null)
                    fw.close();
            } catch (ioexception e) {
                e.printstacktrace();
            }
        }
    }
}

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网