June 2017
Beginner
1296 pages
69h 23m
English
... throws the exception, rather than catching the exception. However, recall from Chapter 11 that when you override a method, the throws clause may contain only the same or a subset of the exception types declared in the original method’s throws clause. Runnable method run does not have a throws clause, so we cannot provide one in line 20. To ensure that the executing thread receives the InterruptedException, line 28 first obtains a reference to the currently executing Thread by calling static method currentThread, then uses that Thread’s interrupt method to deliver the InterruptedException to the current thread.1
Read now
Unlock full access