+ 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?
1 Answer
+ 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){}