线程对象通过调用setDaemon(boolean b)方法来将一个线程设置为守护线程。

如:自定义一个线程SoHuThread(),

// 创建SoHuThread()的对象t

Thread t = new SoHuThread();

// 将t设置为守护线程

t.setDaemon(true);

相关文章:

猜你喜欢
  • 2022-12-23
  • 2021-12-20
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-04-08
相关资源
相似解决方案