摘要: 案例需求 统计一个文件夹中每种文件的个数并打印 打印格式如下: txt:3个 doc:4个 jpg:6个 … 步骤: 1、创建一个File对象,封装要统计的文件夹 2、创建一个Map<String,Integer>集合,键存储后缀名,值存储出现的个数 3、创建一个方法,接收File对象和Map集合 阅读全文
posted @ 2022-05-27 18:32 雾开见月 阅读(571) 评论(0) 推荐(0)
摘要: public static void main(String[] args) throws IOException { BufferedInputStream bis = new BufferedInputStream(new FileInputStream("javase2\\a.txt")); 阅读全文
posted @ 2022-05-27 18:26 雾开见月 阅读(34) 评论(0) 推荐(0)
摘要: /*Stream流 体验Stream流 可以简化集合和数组操作的代码 Stream流流式思想 Stream流是JDK8的新特性 思想类似于工厂里面的生产流水线 流水线只能从前往后,不能回头 Stream流在使用的时候也是只能从前往后,不能回头(不能对一个流多次操作) Stream流的操作步骤 1、获 阅读全文
posted @ 2022-05-24 18:32 雾开见月 阅读(90) 评论(0) 推荐(0)
摘要: /* 收集流 数组 Object[] toArray() :将集合转换为Object数组 <A> A[] toArray(IntFunction<A[]> generator) :将集合转换为指定类型的数组 集合 */public class StreamDemo5 { public static 阅读全文
posted @ 2022-05-24 18:30 雾开见月 阅读(21) 评论(0) 推荐(0)
摘要: package com.itheima7.ArrayList01;import java.util.ArrayList;import java.util.Collection;import java.util.Iterator;public class ArraylestDemo03 { publi 阅读全文
posted @ 2022-05-21 18:25 雾开见月 阅读(62) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { //2、调用获取验证码的方法,将得到的验证码输出到控制台 while (true){ String checkCode = getCheckCode(); System.out.println("当前验证码:"+che 阅读全文
posted @ 2022-05-10 09:49 雾开见月 阅读(402) 评论(0) 推荐(0)
摘要: public static void main(String[] args) {//1. 定义String类型变量s,接收键盘录入的评论信息 Scanner sc = new Scanner(System.in); System.out.println("相信你的评论,一定可以一针见血:"); St 阅读全文
posted @ 2022-05-09 18:35 雾开见月 阅读(106) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { int integral = 1000; double money = 500; int price = 0; Scanner sc = new Scanner(System.in); while (true) { S 阅读全文
posted @ 2022-05-08 19:36 雾开见月 阅读(54) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { int[] arr = {1, 43, 43, 5, 4, 6, 6, 7, 7, 88, 9, 9, 9, 0, 0, 9}; for (int i = 0; i < arr.length; i++) { Rando 阅读全文
posted @ 2022-05-08 14:37 雾开见月 阅读(81) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (int i = 0; i < arr.length; i++) { if (i % 3 == 0) { System.out. 阅读全文
posted @ 2022-05-07 18:40 雾开见月 阅读(66) 评论(0) 推荐(0)