摘要: 阻塞队列 阻塞 写入:如果队列中数据满了,就得阻塞等待 读取:如果队列中无数据,就得阻塞等待 队列 队列遵循FIFO规则 BlockingQueue族谱 BlockingQueue 四种API(四种方法) 方式 抛出异常 不抛异常,正常返回值 阻塞等待 超时等待 添加 add offer put o 阅读全文
posted @ 2022-05-11 17:34 九月!! 阅读(32) 评论(0) 推荐(0)
摘要: /** * 独占锁(写锁):一次只能被一个线程占用 * 共享锁(读锁):多个线程可以同时占有 * ReadWriteLock 是接口 ReentrantReadWriteLock是他的一个实现类 * 读-读: 可以共享 * 读-写: 不可共享 * 写-写: 不可共享 */ public class 阅读全文
posted @ 2022-05-11 16:23 九月!! 阅读(35) 评论(0) 推荐(0)
摘要: public class Test { public static void main(String[] args) throws ExecutionException, InterruptedException { new Thread1().start(); new Thread(new Thr 阅读全文
posted @ 2022-05-11 15:19 九月!! 阅读(23) 评论(0) 推荐(0)
摘要: List不安全 List: //java.util.ConcurrentModificationException 并发修改异常! public class ListTest { public static void main(String[] args) { List<Object> arrayL 阅读全文
posted @ 2022-05-11 15:10 九月!! 阅读(37) 评论(0) 推荐(0)
摘要: CountDownLatch的使用 /* 减法计数器 */ public class Test1 { public static void main(String[] args) throws InterruptedException { CountDownLatch countDownLatch 阅读全文
posted @ 2022-05-11 11:01 九月!! 阅读(19) 评论(0) 推荐(0)
摘要: 1.1 概述 计算机网络 计算器网络是将地理位置不同的具有独立功能的多台计算机及其外部设备,通过通信线路连接起来,在网络操作系统,网络管理软件及网络通信协议的管理和协商下,实现资源共享和信息传递功能的计算机系统 网络编程目的 数据交换,通信 需要怎么做 如何准确地定位网络上的一台主机:IP地址和端口 阅读全文
posted @ 2022-04-13 15:27 九月!! 阅读(33) 评论(0) 推荐(0)
摘要: String param = null; switch (param){ case "null":{ System.out.println("null"); break; } default :{ System.out.println("default"); } } 出现错误:Exception i 阅读全文
posted @ 2022-02-24 17:19 九月!! 阅读(35) 评论(0) 推荐(0)
摘要: File 1.创建File new File(String pathname) //根据路径直接创建File对象(创建在内存中,调用createNewFile()才能在磁盘创建) new File(File parent,String child) //根据父目录文件+子路径构建 new File( 阅读全文
posted @ 2022-02-21 10:28 九月!! 阅读(52) 评论(0) 推荐(0)
摘要: 集合只能存储引用数据类型 COllection 方法: 迭代器的使用遍历集合: Iterator<Person> iterator = list.iterator(); while(iterator.hasNext()){ System.out.println(iterator.next()); } 阅读全文
posted @ 2022-02-21 10:25 九月!! 阅读(30) 评论(0) 推荐(0)
摘要: 1.外部类与内部类 1.成员内部类 一个类里边定义另外一个类,里边的类就叫内部类,外边的就叫外部类 内部类可以访问外部类的成员,即使是私有的。但是要想创建内部类之前就必须先创建外部类。 public class Outer { private int id = 10; void show(){ Sy 阅读全文
posted @ 2022-02-21 10:12 九月!! 阅读(37) 评论(0) 推荐(0)