ThreadTest01.java 443 B

123456789101112131415161718192021
  1. package course;
  2. /**
  3. * @author WanJl
  4. * @version 1.0
  5. * @title ThreadTest
  6. * @description
  7. * @create 2026/8/8
  8. */
  9. public class ThreadTest01 {
  10. public static void main(String[] args) {
  11. //创建自定义线程类的对象
  12. MyThread mt1=new MyThread("线程1");
  13. MyThread mt2=new MyThread("线程2");
  14. //调用自定义线程类的start()方法 启动线程。
  15. mt1.start();
  16. mt2.start();
  17. }
  18. }