What are Daemon threads in Java

0 votes
Please explain me what are Daemon threads and where are they used
Jun 29, 2018 in Java by sharth
• 3,370 points
707 views

1 answer to this question.

0 votes

daemon thread is a thread that is doing some tasks in the background like handling requests or various chronjobs that can exist in an application.

When your program which only has daemon threads remaining, will exit. This is because usually these threads work together with normal threads and provide background handling of events.

You can specify that a Thread is a daemon one by using a setDaemon method, they usually don't exit, neither they are interrupted.. they just stop when an application stops.

answered Jun 29, 2018 by Daisy
• 8,140 points

Related Questions In Java

0 votes
1 answer

What are optional parameters in Java

Using three dots: public void move(Object... x) { ...READ MORE

answered Apr 27, 2018 in Java by developer_1
• 3,350 points
947 views
0 votes
1 answer

What is the concept of Immutability for strings in Java ? Why are strings immutable ?

According to Effective Java, chapter 4, page 73, ...READ MORE

answered May 11, 2018 in Java by Rishabh
• 3,620 points
1,601 views
0 votes
1 answer

What issues should be considered when we are overriding equals and hashCode in Java?

equals() must define an equivalent relation and ...READ MORE

answered Jun 21, 2018 in Java by Sushmita
• 6,920 points
731 views
0 votes
1 answer

What are the different ways of comparing Strings in Java?

The different ways of comparing string in ...READ MORE

answered Mar 5, 2019 in Java by Wasim
985 views
0 votes
1 answer

difference between wait() and sleep() in java

We can find a big difference between ...READ MORE

answered Apr 26, 2018 in Java by developer_1
• 3,350 points
1,214 views
0 votes
1 answer

What is the difference between Runnable and extends Thread

Runnable is the preferred way to create ...READ MORE

answered May 1, 2018 in Java by sharth
• 3,370 points
1,154 views
0 votes
1 answer

How to retrieve current stack trace?

Yes, in Java we do have a ...READ MORE

answered May 17, 2018 in Java by code.reaper12
• 3,500 points
1,800 views
0 votes
1 answer

ThreadLocal variables usage in Java

public class Test { // ...READ MORE

answered Jun 30, 2018 in Java by code.reaper12
• 3,500 points
678 views
0 votes
2 answers

What are all the different ways to create an object in Java?

There are different ways you could do this ...READ MORE

answered Aug 19, 2019 in Java by Sirajul
• 59,230 points
1,158 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,220 points
3,579 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP