hi,
I have following question

1) is main thread is daemon thread? if yes then how?

2) what is meaning of daemon thread?

3) Does daemon thread require main method for execution?

4) Daemon thread do its execution without main method?

5) if Daemon thread require main method can any one told me where is main method of

garbage collector?

6) if its does not require main method then how it gets executed?

Recommended Answers

All 3 Replies

A daemon thread is a thread that does not need to be explicitly ended in order to end the program and it gets started like any other thread, by calling start(). See the Java Concurrency tutorials, there is a sticky thread at the beginning of this forum.

1.No, main thread and daemon thread are different.
2.daemon thread means it will executed continously.
3.no
4.it doesn't require any main() method.
5.same as above
6. it will executed by using thread object..

1.No, main thread and daemon thread are different.
2.daemon thread means it will executed continously.

All threads are executed "continuously", until the thing it is doing is finished or the thread is interrupted.

3.no
4.it doesn't require any main() method.
5.same as above
6. it will executed by using thread object..

IOW, as already said, a daemon thread is no different from a standard user thread, other than the fact that a program will not wait for that thread to finish before exiting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.