If i am having 5 threads in a program and 2 are dameon threads and rest 3 are user threads , if either one of them throw a unhandled exception let it be user thread , will all of my threads will stop running or that particular thread will stop running allowing other threads run safely.
hi the answer to your question is that it won't affect the other thread and only the current thread will throw the exception and since the exception is not handeled it will terminate. hope this solves yours doubt rohit suman
In main, i is 16 In main, i is 17 In main, i is 18 In main, i is 19 In main, i is 0 In main, i is 1 In main, i is 2 In main, i is 3 In main, i is 4 i is 5, i/i is 1 i is 4, i/i is 1 i is 3, i/i is 1 i is 2, i/i is 1 i is 1, i/i is 1 Exception in thread "Thread-0" java.lang.ArithmeticException: / by zero at Job.run(ThreadDemo1.java:7) at java.lang.Thread.run(Unknown Source) In main, i is 5 In main, i is 6 In main, i is 7 In main, i is 8 In main, i is 9 In main, i is 10 In main, i is 11 In main, i is 12 In main, i is 13
Does that answer your question? [ September 12, 2006: Message edited by: Aniket Patil ]
SCJP 5.0 | SCWCD 1.4 <br /> <br />If you don't know where you are going, any road will take you there!
Ajit Amitav Das
posted 13 years ago
Thanks Aniket for a fine example .i got cleared my doubt.
Warm Regards<br />Ajit Amitav Das<br />SCJP 1.5
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop