12345678910111213141516171819202122232425262728 |
- package J20250731.demo02_join;
- /**
- * @author WanJl
- * @version 1.0
- * @title Demo01
- * @description
- * @create 2025/7/31
- */
- public class Demo01 {
- public static void main(String[] args) throws InterruptedException {
- Thread t1 = new Thread(() -> {
- for (int i = 0; i < 1000; i++) {
- String name = Thread.currentThread().getName();
- System.out.println(name + "->" + i);
- }
- });
- Thread t2 = new Thread(() -> {
- for (int i = 0; i < 1000; i++) {
- String name = Thread.currentThread().getName();
- System.out.println(name + "->" + i);
- }
- });
- t1.start();
- t2.start();
- t1.join();
- }
- }
|