import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class TestFile {
public static void main(String[] args) {
// TODO Auto-generated method stub
File f = new File("D:\\testfile1.txt");
try {
f.createNewFile();
FileWriter fw = new FileWriter(f);
String str="程序已经启动\r\n";
fw.write(str);
String s="";
for(int i=0;i<10;i++){
s="这是第"+i+"次循环\r\n";
fw.write(s);
}
fw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}