A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

线程池在张孝祥7k面试题中是如何实现的?

1 个回复

倒序浏览
  1. ExecutorService es = Executors.newSingleThreadExecutor();
  2.                 es.execute(new Runnable(){
  3.                         public void run()
  4.                         {
  5.                                 for(int i = 0 ; i < 100; i++)
  6.                                 {
  7.                                         System.out.println(Thread.currentThread().getName()+">>>>"+i);
  8.                                 }
  9.                         }
  10.                 });
复制代码

大概就这个样子的。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马