1.File類的三種構造方式
創建一個新 File 實例指向給定路徑名字符串表示的抽象路徑名
File(String path)
File file = new File("D:/1.txt");
根據 parent 抽象路徑名和 child 路徑名字符串創建一個新 File 實例
File(File parent, String child)
File parent = new File(D:/src);
File file = new File(parent , "Test.java");
根據 parent 路徑字符串和 child 路徑名字符串創建一個新 File 實例
File(String parent, String child)
String parent = "D:/src";
File file = new File(parent , "Test.java");
2.File類方法
創建功能;
boolean delete() 表刪除
boolean ceratNewFile() 創建指向抽象路徑的空白文件
boolean mkdir() 創建單級目錄(不能創建多級!!)
boolean mkdirs() 創建多級目錄
boolean renameTo(File dest) 剪切并重命名
獲取功能
判斷功能
高級特性