What is daemon thread and how it differs from user thread?
Submitted by: AdministratorA user thread is created by the application (user) while the daemon thread is created by the JVM to provide services to user threads.
If user threads are exists then only daemon threads exists.
You can make a user thread as daemon thread by using setDaemon(true) method.
In an application when only daemon threads are running (i.e. no user thread is running) then JVM will shut down the application and subsequently stops all daemon threads.
To keep the application running, at least one user thread should be running.
Submitted by: Administrator
If user threads are exists then only daemon threads exists.
You can make a user thread as daemon thread by using setDaemon(true) method.
In an application when only daemon threads are running (i.e. no user thread is running) then JVM will shut down the application and subsequently stops all daemon threads.
To keep the application running, at least one user thread should be running.
Submitted by: Administrator
Read Online Java Multi-Threading Job Interview Questions And Answers
Top Java Multi-Threading Questions
☺ | Explain deadlock? |
☺ | What is the sleep() method Data type for the parameter? |
☺ | Explain the difference between preemptive scheduling and time slicing? |
☺ | How many threads at a time can access a monitor? |
☺ | Name the default thread at the time of starting the program? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |