Originally posted by Jack Lau:
oh, then what is the role of user thread and daemon thread ? Any examples ?
Thanks!
Jack
Well, any time you'd run an application, you're creating and using a user thread. A user thread will execute to completion (unless something unforseen stops it from doing so).
A daemon thread, on the other hand, is usually used to perform some sort of background process.
Java's garbage collector is an excellent example of a daemon thread. It performs a background process and, when all of the user threads finish, it is automatically destroyed (what good is a garbage collector when nothing is making anything to collect, anyway?).
I hope that helps,
Corey