Runnable方法Thread子类实现Runnable1. 规避Java单继承缺陷2. 天然实现多线程资源共享3. 代码解耦任务可复用适配线程池 ThreadPoolExecutor 。继承Thread1. 单继承受限无法再继承其他业务父类2. 多线程资源共享繁琐3. 仅适合极简测试demo。
Thread子类创建线程和Runnable创建线程方式对比
Runnable方法Thread子类实现Runnable1. 规避Java单继承缺陷2. 天然实现多线程资源共享3. 代码解耦任务可复用适配线程池 ThreadPoolExecutor 。继承Thread1. 单继承受限无法再继承其他业务父类2. 多线程资源共享繁琐3. 仅适合极简测试demo。