Thread.currentThread()可以获取当前线程的引用,一般都是在没有线程对象又需要获得线程信息时通过Thread.currentThread()获取当前代码段所在线程的引用。

Thread.currentThread()与setDaeMon(boolean c)方法

 

 

setDaeMon(boolean c)当设置为true时,该线程就被设置为守护线程了。

具体实例:

https://blog.csdn.net/he_zhen_/article/details/87456835

在总结时,还发现了Thread.currentThread()与this的区别。

this还是表示当前对象,而Thread.currentThread()表示当前代码被哪个线程在运行。

https://blog.csdn.net/dfshsdr/article/details/92760135

 

相关文章:

  • 2021-06-12
  • 2021-06-16
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
猜你喜欢
  • 2021-11-04
  • 2021-12-02
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案