JAVA小练习134——File的练习
程序员文章站
2022-07-10 13:27:42
...
import java.io.*;
public class Demo134 {
public static void main(String[] args)throws IOException {
/*
File file = new File("F:"+File.separator+"a.txt");
System.out.println("存在吗:"+ file.exists());
System.out.println("目录分隔符:"+ File.separator);
*/
File file2 = new File(".");
System.out.println("当前路径:"+file2.getAbsolutePath());
File file = new File("..\\..\\a.txt");
file.createNewFile();
System.out.println("存在吗:"+ file.exists());
}
}
上一篇: python进阶1 time模块