+ 1

How can you catch an exception thrown by another thread in Java?

How can you catch an exception thrown by another thread in Java?

25th Nov 2017, 8:24 PM
King David
1 Resposta
+ 3
You can add the definition of that thread in try-catch block. or you can put the function call in different try-catch block like: try{ t1.sleep(); }catch(InterruptedException e){} try{ t2.start(); }catch(IllegalThreadStateException e){}
28th Nov 2017, 7:19 PM
Rachit Mishra
Rachit Mishra - avatar