![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
多线程
a894633362
这个作者很懒,什么都没留下…
展开
-
死锁的一个小案例
package com.state; import org.omg.PortableServer.THREAD_POLICY_ID; public class DeadLock { public static void main(String[] args) { Makeup makeup = new Makeup(0,"王子"); Makeup makeup2 = new Makeup(1,"灰姑娘"); makeup.start(); .原创 2021-11-22 15:50:11 · 323 阅读 · 0 评论 -
多线程一个不安全的小案例
package com.state; public class UnsafeBank { public static void main(String[] args) { Accout accout = new Accout(100,"结婚基金"); Drawing you = new Drawing(accout,50,"你"); Drawing girFriend = new Drawing(accout, 100, "老婆大人"); y.原创 2021-11-22 14:03:23 · 164 阅读 · 0 评论 -
线程礼让小练习
package com.exception; //线程礼让 public class TestYield { public static void main(String[] args) { MyYiled myYiled = new MyYiled(); new Thread(myYiled,"龟龟").start(); new Thread(myYiled,"兔兔").start(); } static class MyYile.原创 2021-11-17 10:14:04 · 48 阅读 · 0 评论 -
Runnable 一个卖票小案例
package com.exception; public class TestThread3 implements Runnable { private int a = 10; @Override public void run() { while(true){ if (a<=0){ break; } System.out.println(Thread.currentThread().ge.原创 2021-11-15 17:18:17 · 213 阅读 · 0 评论