package duoxiancheng;
/*
* 守护线程----》后台线程;要在启动线程前定义;
* 所有前台线程结束后,后台线程会自动结束;
* 主线程是前台线程,t1,t2是后台线程;
*
*
*
*
* */
public class Gurdard {
public static void main(String[] args) {
StopThread st=new StopThread();
Thread t1=new Thread(st);
Thread t2=new Thread(st);
t1.setDaemon(true);
t2.setDaemon(true);
t1.start();
t2.start();
int num=0;
while(true)
{
if(num++<60)
{
System.out.println(Thread.currentThread().getName()+"main........."+num);
}
else {
break;
}
}
}
}