多线程
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 · 364 阅读 · 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 · 213 阅读 · 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 · 86 阅读 · 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 · 247 阅读 · 0 评论
分享