posts - 495,  comments - 11,  trackbacks - 0


import java.io.*;

public class FileWriterTest
{
public static void main(String[] args)
{
   FileWriterTest t = new FileWriterTest();
   t.WriteMyFile();
}

void WriteMyFile()
{
   try
   {
    FileWriter fw = new FileWriter("mydata.txt");
    PrintWriter out =new PrintWriter(fw);
    out.print("Hello,World!");
    out.close();
    fw.close();
   }
   catch(IOException e)
   {
    System.out.println("OH,got an IOException error!");
    e.printStackTrace();
   }
}
}

posted on 2007-05-28 00:28 jadmin 阅读(48) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: