一、InterruptedException
Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity. Occasionally a method may wish to test whether the current thread has been interrupted, and if so, to immediately throw this exception. The following code can be used to achieve this effect:
二、illegalArgumentException
传入了一个非法 / 不合适的参数
文章讨论了在Java编程中,当线程在等待、睡眠或其他占用状态时被中断,抛出InterruptedException的情况。同时提到了如何检测并处理这种中断异常。另外,文章还提及了IllegalArgumentException,指出当方法接收到不合适或非法的参数时会抛出此异常。
2516

被折叠的 条评论
为什么被折叠?



