package Thread;
public class TestDaemon {
public static void main(String[] args) {
YYou yYou = new YYou();
God god = new God();
Thread thread = new Thread(god);
thread.setDaemon(true);//默认是false为用户线程
thread.start();
new Thread(yYou).start();
}
}
class YYou implements Runnable {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println("还活着");
}
System.out.println("End World");
}
}class God implements Runnable{
@Override
public void run() {
while (true) {
System.out.println("God守护着你");
}
}
}