interrupt,interrupted,isInterrupted三者区别【附例子】

学了线程这么久, 一直没搞清楚这三者的区别,就在这里区别一下java 1. interruptide interrupt只是设置中断状态,并不会使程序暂停,会继续执行,若是须要显示地暂停程序,必须catch这个InterruptedException,那么捕捉到中断就不会继续程序了;测试 能够对指定线程调用.interrupt()方法;spa 如下测试代码说明catch后暂停程序线程 public
相关文章
相关标签/搜索