核心区别一句话总结“继承 Thread” 是单继承代码简单但灵活性差“实现 Runnable” 更灵活适合多线程共享同一资源也更符合面向接口编程。详细对比表对比项继承 Thread 类实现 Runnable 接口资源共享无法直接共享每个线程有自己的数据多个线程可以共享同一个 Runnable 对象轻松实现资源共享如卖票系统单继承限制受限于 Java 单继承不能再继承其他类无此限制还可以继承其他类或实现多个接口代码耦合度高任务代码和线程控制耦合在一起低任务和线程分离创建方式new MyThread().start()new Thread(runnable).start()适用场景简单、不需要继承其他类时大部分情况尤其是需要灵活设计或线程池场景代码示例说明1. 继承 Thread 类卖票问题演示缺陷javaclass TicketThread extends Thread { private int tickets 5; public void run() { while (tickets 0) { System.out.println(getName() 卖票剩余 --tickets); } } } // 使用 TicketThread t1 new TicketThread(); TicketThread t2 new TicketThread(); t1.start(); t2.start(); // 结果每个线程各自卖出5张总共卖出10张错误❌2. 实现 Runnable 接口正确共享javaclass TicketRunnable implements Runnable { private int tickets 5; public void run() { while (tickets 0) { System.out.println(Thread.currentThread().getName() 卖票剩余 --tickets); } } } // 使用 TicketRunnable task new TicketRunnable(); Thread t1 new Thread(task); Thread t2 new Thread(task); t1.start(); t2.start(); // 结果两个线程共享5张票总共卖出5张正确✅底层与设计层面补充Thread 本身也实现了 RunnableThread类的run()方法来自Runnable接口。线程池只能接受 Runnable 或 CallableExecutorService.submit(Runnable task)不支持直接提交Thread子类对象。推荐优先使用 Runnable因为它更符合“组合优于继承”的设计原则。