1.通过Thread类
new Thread
2.实现runnable接口
无返回值
3.实现Callable接口
有返回值
4.通过线程池通过工厂模式创建,本质上还是前三种的使用
四种方式:a:newSingleThreadPoolExecutor
b:newFixedThreadPoolExecutor
c:newCacheThreadPoolExecutor
d:newScheduledThreadPoolExecutor
1.通过Thread类
new Thread
2.实现runnable接口
无返回值
3.实现Callable接口
有返回值
4.通过线程池通过工厂模式创建,本质上还是前三种的使用
四种方式:a:newSingleThreadPoolExecutor
b:newFixedThreadPoolExecutor
c:newCacheThreadPoolExecutor
d:newScheduledThreadPoolExecutor