import java.io.File;
public class CreateFolderExample {
public static void main(String[] args) {
String folderPath = "path/to/folder"; // 文件夹路径
File folder = new File(folderPath);
// 检查文件夹是否存在
if (!folder.exists()) {
// 创建文件夹
boolean created = folder.mkdirs();
if (created) {
System.out.println("文件夹创建成功!");
} else {
System.out.println("文件夹创建失败!");
}
} else {
System.out.println("文件夹已存在!");
}
}
}