线程池只是一个负责创建和管理线程任务的池子,具体概念在:[线程池的简单的底层解析和使用
](https://blog.csdn.net/whiteBearClimb/article/details/107504976?ops_request_misc=%25257B%252522request%25255Fid%252522%25253A%252522161173244316780266221766%252522%25252C%252522scm%252522%25253A%25252220140713.130102334.pc%25255Fblog.%252522%25257D&request_id=161173244316780266221766&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogfirst_rank_v1~rank_blog_v1-2-107504976.pc_v1_rank_blog_v1&utm_term=%25E7%25BA%25BF%25E7%25A8%258B%25E6%25B1%25A0),如果往这个池子提交线程任务呢?
两种方式:execute和submit
(1)execute用于提交无返回值的任务,也就是某个class继承了Runnable接口并且重写了run方法的任务。
static class ThreadTask implements Runnable{
@Override
public void run() {
System.out.println("正在执行多线程任务......");
}
}