摘要: 1 /** 2 * 使用同步方法模拟12306抢票 3 */ 4 public class SynMethed12306 { 5 public static void main(String[] args) { 6 Web12306 one = new Web12306(); 7 new Threa 阅读全文
posted @ 2020-07-08 19:52 梅竹疯狂打豆豆 阅读(243) 评论(0) 推荐(0)
摘要: 1 /** 2 * 守护线程:是为了用户线程服务的;jvm停止不用等待守护线程执行完毕 3 * 默认:用户线程 ,jvm等待用户线程执行完毕才会停止 4 */ 5 public class DaemonThread { 6 public static void main(String[] args) 阅读全文
posted @ 2020-07-08 16:29 梅竹疯狂打豆豆 阅读(169) 评论(0) 推荐(0)
摘要: 1 /** 2 * 线程join方法 3 * 作用:类似于插队,让资源调度器优先调用自己,只有等自己执行完毕,才能执行其他线程 4 */ 5 public class JoinThread { 6 public static void main(String[] args) { 7 new Thre 阅读全文
posted @ 2020-07-08 13:24 梅竹疯狂打豆豆 阅读(353) 评论(0) 推荐(1)