2019年8月16日

(线程池的使用)小练习

只有注册用户登录后才能阅读该文。 阅读全文

posted @ 2019-08-16 08:31 年夜饭 阅读(1) 评论(0) 推荐(0) 编辑

信号量的使用

摘要: 1 package com.ccp.Lc0815; 2 3 import java.util.concurrent.Semaphore; 4 5 public class Test { 6 public static void main(String[] args) { 7 //定义一个信号量对象 8 Semaphore s = new Semaphore(1); 9 //同时启动5个线程 10 阅读全文

posted @ 2019-08-16 08:28 年夜饭 阅读(281) 评论(0) 推荐(0) 编辑

Timer使用

摘要: 1 package com.ccp.Lc0815; 2 3 import java.util.Timer; 4 import java.util.TimerTask; 5 6 public class Timers { 7 public static void main(String[] args) { 8 Timer timer = new Timer() ; 9 //schedule(要做的事 阅读全文

posted @ 2019-08-16 08:27 年夜饭 阅读(119) 评论(0) 推荐(0) 编辑

(售票)线程小练习

摘要: 1 package com.ccp.Lc0814; 2 3 public class Ticket { 4 char c;//用户 5 boolean is=false; 6 public synchronized void ticket1(char c) throws InterruptedException { 7 if (is){ ... 阅读全文

posted @ 2019-08-16 08:26 年夜饭 阅读(112) 评论(0) 推荐(0) 编辑

流的使用

摘要: 1 package com.ccp.Lc0813; 2 3 import java.io.*; 4 5 public class TextFile { 6 public static void main(String[] args) throws IOException { 7 File file=new File("D://text");... 阅读全文

posted @ 2019-08-16 08:22 年夜饭 阅读(161) 评论(0) 推荐(0) 编辑

导航