package com.Thread;
import sun.rmi.runtime.Log;
public class Thread0202 extends Thread {
public void run() {
Thread0201 t1 = new Thread0201();
Thread0201 t2 = new Thread0201();
// 使用Runnable接口创建线程
Thread one = new Thread(new Thread0201(), "one");
Thread two = new Thread(new Thread0201(), "two");
one.start();
two.start();
// 为什么start一开始 下面的命令不会执行 而且厮杀过程一直不会停止
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
t1.i = false;
t2.i = false;
try {
two.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new Thread0202().start();
}
}
qq_青枣工作室_0
相关分类