Java線程wait()、sleep()、yield()、join()方法的區別-總結

1、sleep() sleep()是Thread類方法,它作用是在指定的毫秒數內讓當前「正在執行的線程」休眠(暫停執行)。這個「正在執行的線程」是指this.currentThread()返回的線程。 sleep方法有兩個重載版本: sleep(long millis)     //參數爲毫秒 sleep(long millis,int nanoseconds)    //第一參數爲毫秒,第二個參
相關文章
相關標籤/搜索