Java 生成文档

package com.zihan.org.file;

import java.io.FileWriter;

public class FileTest {   

    public FileTest() {  
    }   

    public static void main(String[] args) {  
        FileWriter fw = null;
        try {
            fw = new FileWriter("C:/add2.xml");
            fw.write("你好,我是姚冬1120");  
            System.out.println("写入成功");   

        } catch (Exception e) {
            e.printStackTrace();  
        }  
        finally {  
            try {
                fw.close();  
            } catch (Exception e) {
                e.printStackTrace();  
            }   

        }   

    }   

}

posted @ 2013-05-04 16:54  紫寒1120  阅读(131)  评论(0编辑  收藏  举报