本文介绍了Java 中的守护线程是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我 Java 中的守护线程是什么?
Can anybody tell me what daemon threads are in Java?
推荐答案
守护线程是在程序完成但线程仍在运行时不阻止 JVM 退出的线程.守护线程的一个例子是垃圾收集.
A daemon thread is a thread that does not prevent the JVM from exiting when the program finishes but the thread is still running. An example for a daemon thread is the garbage collection.
您可以使用 setDaemon(boolean)
方法在线程启动之前更改 Thread
守护进程的属性.
You can use the setDaemon(boolean)
method to change the Thread
daemon properties before the thread starts.
这篇关于Java 中的守护线程是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!