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,320 points
79 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,050 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,300 points
62 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,540 points
155 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,880 points
31 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
43 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,300 points
61 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,320 points
94 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
122 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
37 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 in Java by Sirajul
• 25,220 points
69 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
316 views