随笔 - 11  文章 - 32  trackbacks - 0
<2007年8月>
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

sdfsd

常用链接

留言簿

随笔分类

随笔档案

文章档案

搜索

  •  

最新随笔

最新评论

阅读排行榜

评论排行榜

这是一个简单的往文件里写内容的方法:

  public void writeFile(String fileName, String content) throws Exception {
    File f = new File(fileName);
    if (f.exists()) {
      f.delete();
    }
    f.createNewFile();
    FileWriter fileWriter = new FileWriter(f);
    PrintWriter writer = new PrintWriter(fileWriter);
    writer.write(content);
    writer.flush();
    writer.close();
  }

posted on 2007-08-24 10:43 teasp 阅读(150) 评论(0)  编辑  收藏 所属分类: Java学习



标题  
姓名  
主页
验证码 *  
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2007-08-24 11:38 编辑过
 
 
相关链接:
网站导航: