... 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

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.