![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
多线程
PJJ彭彭彭
这个作者很懒,什么都没留下…
展开
-
多线程交替打印ABABAB
package testJunit;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;class Solution{ public static void main(String[] args) { Thread t1 = new Thread(new Threada()...原创 2020-03-01 14:05:03 · 771 阅读 · 0 评论 -
多线程执行屏障问题
我们需要构造2道屏障,second线程等待first屏障,third线程等待second屏障。first线程会释放first屏障,而second线程会释放second屏障。实例:class Foo { public boolean secondFinished = false; public boolean thirdFinished =...原创 2020-01-12 22:12:34 · 238 阅读 · 0 评论 -
线程池的应用
public static void main(String[] args) { final String str="abc"; ExecutorService executorService= Executors.newFixedThreadPool(3); executorService.execute(new Runnable() { @Override publ...原创 2020-02-11 15:11:44 · 189 阅读 · 0 评论