62,614
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
File file = new File("resources");
if (!file.exists()) {
file.mkdir();
System.out.println("ok");
}
System.out.println(file.getAbsolutePath());
File file2 = new File(file, "one.dat");
if (!file2.exists()) {
try {
file2.createNewFile();//file2 不是file
System.out.println("file2 created");
} catch (IOException e) {
System.out.println("error");
}
System.out.println(file2.getAbsolutePath());
}
System.out.println(file2.exists());
}