First, put a overstack on the answer:
Understand:
(1) throws Interruptedexception is part of your method declaration and the return value of the method you call.
(2) When your method calls another method and throws a Interruptexception exception, you should think: is interruptexception a meaningful result for your method? If it is, Then your method can make an exception declaration and propagate the exception up. For example: Your method needs to wait for the network to pass over the numeric parameters to complete the calculation and return the results, if the network has been blocked so that the calculation process cannot be completed, you can spread the interruptedexception exception upward. If not, then you cannot Interruptedexception is thrown, but it should be captured. There are two things you should memorize in your heart: 1. Other threads may block your thread, or if you want to gracefully cancel your operation, you should return as soon as possible. 2. Even if your method can return meaningful values when encountering interruptedexception, the fact that the thread is disturbed is also important. If you call the code of your method and want to know if your method is experiencing interference during execution, You should write down: Threaed.currentthread (). Interrupt ()
The study of Interruptedexception