How to create daemon thread in Java !!!!
Java has two types of threads: daemon and user. The threads that we have looked in our previous videos, were user threads. A daemon thread is identical to a user thread in almost every way. The one exception occurs in determining when the virtual machine exits. The virtual machine automatically exits when all user threads have exited. Daemon threads only live to serve user threads; if there are no more user threads, there is nothing to serve and no reason to continue. It’s like house keeper, if you do not have what to do , you are fired. The daemon mode of a thread is set by calling the setDaemon() method with either true (set to daemon mode) or false (set to user mode). The setDaemon() method can be called only before the thread has been started. thread java,threads java,thread.sleep java,threads in java,what is thread in java,thread in java,threading in java,concurrency,thread,java interview questions,java,java programming
Похожие видео
Показать еще