I am trying to understand the difference between Daemon threads and user-level threads.As i gather, the main
thread will exit irespective of whether there are any daemon threads running. Main only waits for user-level threads to complete(please let me know if this is wrong).
To understand this, i wrote a code fragment as:
When i run this code, i get the following output :
the last statement shouldnt have figured in the output. That being said, when i increase the sleep time of the daemon thread to a "sufficiently" large value(say 100 ms), i get the expected output:
Can anyone reason why i am getting the statement in bold(Exiting Daemon Thread ...) during my first run(code inline)?
[ December 03, 2008: Message edited by: Monu Tripathi ]