---
title: "What is Daemon thread in java"  
description: "What is Daemon thread in java"  
author: "Anonymous User"  
published: 2015-09-03  
updated: 2015-09-03  
canonical: https://www.mindstick.com/forum/33437/what-is-daemon-thread-in-java  
category: "java"  
tags: ["java", "thread"]  
reading_time: 1 minute  

---

# What is Daemon thread in java

I am very much confused about [daemon threads](https://www.mindstick.com/interview/2493/what-about-the-daemon-threads), can [anyone tell me](https://www.mindstick.com/interview/23033/can-anyone-tell-me-about-hadoop-toolbox) what is daemon threads and why we use them?

## Replies

### Reply by Anonymous User

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.\
You can use the setDaemon() method to change the Thread daemon properties.When a new thread is created it inherits the daemon status of its parent.Normal thread and daemon [threads](https://www.mindstick.com/blog/11678/threads-in-java) differ in what happens when they exit. When the JVM halts any remaining daemon threads are abandoned:\
finally blocks are not executed,stacks are not unwound - the JVM just exits.\
Due to this reason daemon threads should be used sparingly and it is dangerous to use them for tasks that might perform any sort of I/O.


---

Original Source: https://www.mindstick.com/forum/33437/what-is-daemon-thread-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
