如果一個方法后面有“throws InterruptedException”(即會拋出InterruptedException異常的方法),表示這個方法內(或是這個方法中所調用的方法內),可能會拋出InterruptedException異常。在多線程程序設計中,這通常告訴我們兩點:
文章來源:http://localhost/wp2/?p=99
- 這是“需要時間”的方法
- 這是“可以取消”的方法
- java.lang.Object類(及其子類)實例的wait方法
- java.lang.Object類(及其子類)實例的sleep方法
- java.lang.Thread類(及其子類)實例的join方法
文章來源:http://localhost/wp2/?p=99