import java.io.File;
import java.io.IOException;
public class Test02 {
public static void main(String[] args) {
// TODO Auto-generated method stub
File dir = new File("D:/a/b/c");
if(!dir.exists()) {
dir.mkdirs();
}
File file = new File("D:/a/b/c/haha.xls");
try {
System.out.println(file.createNewFile());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Thread.sleep(10*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
file.delete();
}
}
創建一個文件d:/a/b/c/haha.xls 10秒後將這個文件刪除 Thread.sleep(10*1000)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.