摘要: package state; public class TestPoriority { public static void main(String[] args) { MyPoriority myPoriority = new MyPoriority(); Thread t1 = new Thre 阅读全文
posted @ 2023-03-10 23:03 北极有熊ovo 阅读(18) 评论(0) 推荐(0)
摘要: package state; public class TestState { public static void main(String[] args) { Thread thread = new Thread(()->{ for (int i = 0; i < 5; i++) { try { 阅读全文
posted @ 2023-03-10 20:59 北极有熊ovo 阅读(14) 评论(0) 推荐(0)
摘要: package state; public class TestJoin implements Runnable{ @Override public void run() { for (int i = 0; i < 1000; i++) { System.out.println("vip线程"+i+ 阅读全文
posted @ 2023-03-10 20:23 北极有熊ovo 阅读(21) 评论(0) 推荐(0)
摘要: package state; //礼让不一定成功,看cpu调度 public class TestYield { public static void main(String[] args) { MyYield myYield = new MyYield(); new Thread(myYield, 阅读全文
posted @ 2023-03-10 19:47 北极有熊ovo 阅读(15) 评论(0) 推荐(0)
摘要: package state; //模拟网络延时的作用:放大问题发生的可能性 public class TestSleep implements Runnable{ private int ticket = 10; @Override public void run() { while (true){ 阅读全文
posted @ 2023-03-10 19:34 北极有熊ovo 阅读(20) 评论(0) 推荐(0)
摘要: package lambda; public class TestLambda { //2.静态内部类 static class Like2 implements ILike{ @Override public void lambda() { System.out.println("i like 2 阅读全文
posted @ 2023-03-10 11:04 北极有熊ovo 阅读(21) 评论(0) 推荐(0)