摘要: 是因为文档下方空白回车太多。删除空白即可 阅读全文
posted @ 2024-04-08 11:04 冷风5997 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 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:38 冷风5997 阅读(1) 评论(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:59 冷风5997 阅读(3) 评论(0) 推荐(0) 编辑
摘要: listFiles方法注意事项: 当调用者不存在时,返回null 当调用者是一个文件时,返回null 当调用者是一个空文件夹时,返回一个长度为0的数组 当调用者是一个有内容的文件夹时,将里面所有文件和文件夹的路径放在File数组中返回 当调用者是一个有隐藏文件的文件夹时,将里面所有文件和文件夹的路径 阅读全文
posted @ 2024-03-28 15:39 冷风5997 阅读(1) 评论(0) 推荐(0) 编辑
摘要: public class Test04 { // public boolean isDirectory() 测试此抽象路径名表示的File是否为目录 // public boolean isFile() 测试此抽象路径名表示的File是否为目录 // public boolean exists() 阅读全文
posted @ 2024-03-28 15:29 冷风5997 阅读(1) 评论(0) 推荐(0) 编辑
摘要: //注意点: //1、删除后不进入回收站 //2、如果删除的是文件和空文件夹,那么直接删除 //3、如果删除一个有内容的文件夹,不能直接删除,只能先进入文件夹,删除里面内容后才能删除文件夹 public class Test03 { public static void main(String[] 阅读全文
posted @ 2024-03-28 15:09 冷风5997 阅读(2) 评论(0) 推荐(0) 编辑
摘要: public class Test02 { public static void main(String[] args) throws IOException { //public boolean createNewFile()创建一个新的空的文件(文件所在文件夹必须存在,否则错误) method1 阅读全文
posted @ 2024-03-28 15:01 冷风5997 阅读(3) 评论(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 阅读(2) 评论(0) 推荐(0) 编辑
摘要: public class Test07 { public static void main(String[] args) { /* * 创建一个ArrayList集合,并添加以下字符串。字符串中前面是姓名,后面是年龄 * "zhangsan,23""lisi, 24""wangwu, 25""保留年 阅读全文
posted @ 2024-03-27 16:43 冷风5997 阅读(1) 评论(0) 推荐(0) 编辑
摘要: /* stream流的收集方法 练习:定义一个集合,并添加一些整数1,2, 3,4, 5,6,7,8,9, 10 将集合中的奇数删除,只保留偶数。 遍历集合得到2,4,6,8,10。*/ public class Test06 { public static void main(String[] a 阅读全文
posted @ 2024-03-26 22:09 冷风5997 阅读(1) 评论(0) 推荐(0) 编辑