创建文件

package com.cn.file;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

public class abc {

public static void main(String[] args) throws IOException {

File file1=new File("E://dir1");

if(file1.exists()) {
file1.delete();
System.out.println("文件已存在,被删除");
}else {
boolean e=file1.createNewFile();
System.out.println("文件不存在,创建成功");
}
}

}

posted @ 2020-11-18 17:38  hrhnp  阅读(110)  评论(0)    收藏  举报