But then the compiler or IDE balks that you haven't dealt with the checked InterruptedException.
但是编译器或IDE报错说没有处理检查到的InterruptedException。
When a blocking method detects interruption and throws InterruptedException, it clears the interrupted status.
当一个阻塞方法检测到中断并抛出InterruptedException时,它清除中断状态。
Since this application has not defined another thread to cause the interrupt, it doesn't bother to catch InterruptedException.
由于这个应用程序并没有定义其他的线程,所以并不用关心如何处理该异常。
Sometimes throwing InterruptedException is not an option, such as when a task defined by Runnable calls an interruptible method.
有时候抛出InterruptedException并不合适,例如当由Runnable定义的任务调用一个可中断的方法时,就是如此。
When a method throws InterruptedException, it is telling you several things in addition to the fact that it can throw a particular checked exception.
当一个方法抛出InterruptedException时,它不仅告诉您它可以抛出一个特定的检查异常,而且还告诉您其他一些事情。
When a method throws InterruptedException, it is telling you several things in addition to the fact that it can throw a particular checked exception.
当一个方法抛出InterruptedException时,它不仅告诉您它可以抛出一个特定的检查异常,而且还告诉您其他一些事情。
应用推荐