继承Thread类 通过继承Thread类并重写其run()方法来定义线程执行的任务。 依赖包 java.lang.Thread; 1. 基础使用 MyThreadTest 类 public class MyThreadTest extends