/**
* @Author: ZhangHao
* @Description: ThreadTest
* @Date: 2020/3/30 14:14
* @Version: 1.0
*/
public class ThreadTest {
static Thread thread;
public static void main(String[] args) {
thread = new Thread(() -> {
for(int i = 0;i < 10000;i++){
System.out.println(1);
}
// 不影響run方法的繼續執行
thread = null;
for(int i = 0;i < 10000;i++){
System.out.println(2);
}
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
thread.start();
}
}