import java.io.*;
public class Fan {
public static void main(String[] args) {
String path ="d://upload_test//file"; //设置一个默认文件夹路径
File uploadFilePath = new File(path);
// 如果该目录不存在,则创建之
if(uploadFilePath.exists() == false) {
uploadFilePath.mkdirs();
System.out.println("路径不存在,但是已经成功创建了" + path);
}else{
System.out.println("文件路径存在" + path);
}
String filePath = path+"//xin.txt";
File createFile = new File(filePath);
try {
createFile.createNewFile();
System.out.println("文件创建成功!");
} catch (IOException e) {
System.out.println("文件创建失败了!");
e.printStackTrace();
}
}
}