本文共 310 字,大约阅读时间需要 1 分钟。
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("文件已存在!"); }}
转载地址:http://pbell.baihongyu.com/