摘要: 案例一 package com.chengguo.线程; /** * 同步锁之买票不安全的情况演示 */ public class Demo_20200523001_SynchronizedUnsafe { public static void main(String[] args) { //创建对 阅读全文
posted @ 2020-06-18 17:29 忧桑の民工 阅读(139) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 同步锁之买票不安全的情况演示 */ public class Demo_20200523001_SynchronizedUnsafe { public static void main(String[] args) { //创建对象调用方 阅读全文
posted @ 2020-06-18 17:28 忧桑の民工 阅读(100) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 线程守护【举例:上帝守护人类】 */ public class Demo_20200522001_Daemon { public static void main(String[] args) { //创建线程 God god = new 阅读全文
posted @ 2020-06-18 17:27 忧桑の民工 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 详解 阅读全文
posted @ 2020-06-15 00:38 忧桑の民工 阅读(63) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 观察线程的状态 */ public class Demo_20200518005_State { public static void main(String[] args) throws InterruptedException { / 阅读全文
posted @ 2020-06-15 00:38 忧桑の民工 阅读(67) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 测试线程的优先级 */ public class Demo_20200519001_Priority { public static void main(String[] args) { //主线程默认优先级 System.out.pri 阅读全文
posted @ 2020-06-15 00:36 忧桑の民工 阅读(94) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 线程守护【举例:上帝守护人类】 */ public class Demo_20200522001_Daemon { public static void main(String[] args) { //创建线程 God god = new 阅读全文
posted @ 2020-06-15 00:35 忧桑の民工 阅读(108) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 测试 join方法【想象为插队】 */ public class Demo_20200518004_Join implements Runnable { @Override public void run() { for (int i = 阅读全文
posted @ 2020-06-03 23:40 忧桑の民工 阅读(123) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; /** * 测试线程礼让 */ public class Demo_20200518002_Yield { public static void main(String[] args) { MyYield myYield = new MyYield( 阅读全文
posted @ 2020-06-03 23:39 忧桑の民工 阅读(110) 评论(0) 推荐(0) 编辑
摘要: package com.chengguo.线程; import java.text.SimpleDateFormat; import java.util.Date; /** * 模拟倒计时 */ public class Demo_20200518001_Sleep { public static 阅读全文
posted @ 2020-06-03 23:38 忧桑の民工 阅读(146) 评论(0) 推荐(0) 编辑