摘要: 缓冲区法 生产者 消费者 产品 容器 public class TestTwo { // 生产者 消费者 容器 产品 public static void main(String[] args) { Home home = new Home(); new Thread(new Productor(h 阅读全文
posted @ 2022-01-04 01:10 窃窃私语QAQ 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 注解 大多数框架的底层; 注解:给机器看的 注释:给人看的 元注解 Java定义了四个标准的meta-annotation类型,它们被用来提供对其他annotation类型作说明; @Target 作用域 用于描述注解的使用范围:@Target(value = ElementType.METHOD) 阅读全文
posted @ 2022-01-04 01:10 窃窃私语QAQ 阅读(26) 评论(0) 推荐(0) 编辑
摘要: import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.use 阅读全文
posted @ 2021-12-22 22:26 窃窃私语QAQ 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 不解释,先上代码 import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import lombok.extern.slf4j.Slf4j; import org.jsoup.Jsoup; import org.jsoup. 阅读全文
posted @ 2021-12-22 22:18 窃窃私语QAQ 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 并发 解决办法:队列 + 锁 线程不安全示例(操作同一个对象) public static void main(String[] args) { BuyTicket buyTicket = new BuyTicket(); // BuyTicket buyTicket1 = new BuyTicke 阅读全文
posted @ 2021-12-09 22:23 窃窃私语QAQ 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 守护线程、用户线程 线程默认的都是用户线程,我们需要设置thread.setDaemon(true)来改为守护线程; 守护线程,虚拟机不会监测它,等别的线程都跑完了,守护线程会自动停止; public static void main(String[] args) { Teacher teacher 阅读全文
posted @ 2021-12-09 21:59 窃窃私语QAQ 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 简单的lambda使用 interface AAAA{ // 如果存在两个方法,那就无法使用lambda表达式了 void print(); } class BBBB{ public static void main(String[] args) { AAAA a = () -> System.ou 阅读全文
posted @ 2021-12-09 21:03 窃窃私语QAQ 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 继承Thread类 public class TestThread extends Thread{ private String url; private String name; public TestThread(String url,String name){ this.url = url; 阅读全文
posted @ 2021-12-08 21:32 窃窃私语QAQ 阅读(2) 评论(0) 推荐(0) 编辑
摘要: super关键字 super调用父类的构造方法,必须在构造方法的第一个。 super必须只能出现在子类的方法或者构造方法中。 super和this 不能同时调用构造方法(因为他俩都必须在构造方法的第一行)。 阅读全文
posted @ 2021-12-07 20:06 窃窃私语QAQ 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 静态导入包 import static java.lang.Math.random; // 只导入类的某个方法 阅读全文
posted @ 2021-10-07 22:40 窃窃私语QAQ 阅读(29) 评论(0) 推荐(0) 编辑