摘要: public class Test07 { public static void main(String[] args) { File src = new File("F:\\test\\apple\\src"); deleteSrc(src); } private static void dele 阅读全文
posted @ 2024-03-28 16:37 冷风5997 阅读(18) 评论(0) 推荐(0)
摘要: public class Test06 { public static void main(String[] args) throws IOException { File file = new File("untitledOne\\aaa"); if (!file.exists()) { //如果 阅读全文
posted @ 2024-03-28 15:58 冷风5997 阅读(80) 评论(0) 推荐(0)
摘要: listFiles方法注意事项: 当调用者不存在时,返回null 当调用者是一个文件时,返回null 当调用者是一个空文件夹时,返回一个长度为0的数组 当调用者是一个有内容的文件夹时,将里面所有文件和文件夹的路径放在File数组中返回 当调用者是一个有隐藏文件的文件夹时,将里面所有文件和文件夹的路径 阅读全文
posted @ 2024-03-28 15:39 冷风5997 阅读(41) 评论(0) 推荐(0)
摘要: public class Test04 { // public boolean isDirectory() 测试此抽象路径名表示的File是否为目录 // public boolean isFile() 测试此抽象路径名表示的File是否为目录 // public boolean exists() 阅读全文
posted @ 2024-03-28 15:29 冷风5997 阅读(14) 评论(0) 推荐(0)
摘要: //注意点: //1、删除后不进入回收站 //2、如果删除的是文件和空文件夹,那么直接删除 //3、如果删除一个有内容的文件夹,不能直接删除,只能先进入文件夹,删除里面内容后才能删除文件夹 public class Test03 { public static void main(String[] 阅读全文
posted @ 2024-03-28 15:09 冷风5997 阅读(21) 评论(0) 推荐(0)
摘要: public class Test02 { public static void main(String[] args) throws IOException { //public boolean createNewFile()创建一个新的空的文件(文件所在文件夹必须存在,否则错误) method1 阅读全文
posted @ 2024-03-28 15:01 冷风5997 阅读(28) 评论(0) 推荐(0)
摘要: public class Test01 { public static void main(String[] args) { method1(); method2(); method3(); } private static void method3() { // File (File parent 阅读全文
posted @ 2024-03-28 14:36 冷风5997 阅读(60) 评论(0) 推荐(0)