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 閱讀(49)
評論(0) 編輯 收藏