package cn.lijun.demo3; import java.io.File;
import java.io.IOException; // 创建文件功能 如果文件已经存在 不再创建
public class FileDemo2 {
public static void main(String[] args) throws IOException {
fun3();
}
//删除
public static void fun3(){
File file1 =new File("c:\\baixiaolong\\b.txt");
boolean b = file1.delete();
System.out.println(b); }
//创建目录
public static void fun2() throws IOException{
File file =new File("c:\\baixiaolong");
boolean m = file.mkdirs();
System.out.println(m);
File file1 =new File("c:\\baixiaolong\\b.txt");
boolean s = file1.createNewFile();
System.out.println(s);
}
public static void fun() throws IOException{
File file =new File("c:\\a.txt");
boolean b = file.createNewFile();
System.out.println(b);
} }