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,310 points
50 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,020 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,220 points
38 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,520 points
96 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,820 points
22 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 in Java by Wasim
21 views
0 votes
1 answer

difference between wait() and sleep() in java

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

answered Apr 25, 2018 in Java by developer_1
• 3,220 points
44 views
0 votes
1 answer

What is the difference between Runnable and extends Thread

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

answered Apr 30, 2018 in Java by sharth
• 3,310 points
64 views
0 votes
1 answer

How to retrieve current stack trace?

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

answered May 16, 2018 in Java by code.reaper12
• 3,450 points
79 views
0 votes
1 answer

ThreadLocal variables usage in Java

public class Test { // ...READ MORE

answered Jun 29, 2018 in Java by code.reaper12
• 3,450 points
26 views
0 votes
1 answer

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

There are four different ways to create ...READ MORE

answered Oct 16, 2018 in Java by Daisy
• 8,020 points
43 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,190 points
98 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.