Yogesh Gandhi wrote:But getting the main thread down will not automatically let the child threads down?
No, why would it? (By the way your term "child thread" doesn't correspond to anything in the
Java runtime, it's just how you think of the threads. There isn't any way for a thread to determine which thread created it.)
I have not written any special code to terminate the thread.
And so that's why it doesn't terminate. (Your mental picture of a tree structure of threads with parents and children, where the children must stop if the parent stops, doesn't correspond to reality.)
Well if you have any idea how can i write such a code..can you please help me with a dummy example?
The usual way is for the master thread to interrupt the slave thread, and for the slave thread to be written in such a way that when it is interrupted it terminates. Quite often this is arranged by the slave thread to have a boolean variable, which it checks periodically, and when something (i.e. the master thread) sets that variable to true (let's say) then the slave thread terminates when it notices that.