public class test {
public static void main(String[] args)throws IOException {
File haha = new File("D://1.zip");
// 创建文件createNewFile()
boolean flag =haha.createNewFile();
System.out.println(flag?"创建 成功":"创建失败");
File dir = new File("D://hha");
// 创建文件夹mkdir()
dir.mkdir();
File dirs = new File("D://hh/dajsdsa/");
dirs.mkdirs();
}
}
原文:https://www.cnblogs.com/heng98/p/14806262.html