package com.Java;

//守护线程
//虚拟机不需要等待守护线程执行完
//虚拟机必须等待用户线程执行完
public class TestDaemon {
public static void main(String[] args) {
God god = new God();
Yous yous = new Yous();
Thread t1 = new Thread(god);
t1.setDaemon(true);//将上帝改成守护线程 默认false 正常线程都是用户线程
t1.start();
new Thread(yous).start();
}
}
class God implements Runnable{

@Override
public void run() {
while(true){
System.out.println("上帝守护着你");
}
}
}
class Yous implements Runnable{

@Override
public void run() {
for (int i = 0; i < 36000; i++) {
System.out.println(i);
}
System.out.println("我没了===========");
}
}