import java.io.*;
import java.util.*;
import java.text.*;
class CreateFile{
static public void main(String[] str) throws IOException{
File root=new File("D:/");
SimpleDateFormat mat=new SimpleDateFormat
("yyyy-MM-dd hh:mm:ss");
for(int i=0;i<10*10*10;i++){
String name=String.valueOf((int)Math.random()*123456)+".txt";
File temp=new File(root,name);
temp.createNewFile();
PrintWriter p=new PrintWriter(temp);
p.println(mat.format(new Date()));
p.close();
}
}
}
温馨提示:答案为网友推荐,仅供参考