import java.io.File;
import java.io.IOException;
public class CreateFile {
public static void main(String[] args) throws IOException {
File file = new File("cpyFile2");
if (file.createNewFile())
System.out.println("文件创建成功!");
else
System.out.println("文件已存在!");
}
}
![img_3b8c1b89e5355349c65182ddd4397377.png](https://yqfile.alicdn.com/img_3b8c1b89e5355349c65182ddd4397377.png?x-oss-process=image/resize,w_1400/format,webp)