线程对象通过调用setDaemon(boolean b)方法来将一个线程设置为守护线程。
如:自定义一个线程SoHuThread(),
// 创建SoHuThread()的对象t
Thread t = new SoHuThread();
// 将t设置为守护线程
t.setDaemon(true);
线程对象通过调用setDaemon(boolean b)方法来将一个线程设置为守护线程。
如:自定义一个线程SoHuThread(),
// 创建SoHuThread()的对象t
Thread t = new SoHuThread();
// 将t设置为守护线程
t.setDaemon(true);
转载于:https://www.cnblogs.com/jh5240/archive/2012/02/26/2368817.html