Kamis, 24 November 2016

What are the different thread methods in java

Even though threads are independent most of the time, there might some instances at which we want a certain thread to wait until all other threads complete their execution. In such situations we can use isAlive() and join()methods. Syntax of these methods is as follows: final boolean isAlive() final void join() throws InterruptedException final void join(long milliseconds) throws InterruptedException The isAlive() method can be used to find whether the thread is still running or not. If the thread is still running, it will return true. Otherwise, it will return false. The join() method makes the thread to wait until the invoking thread terminates. Below program

The post What are the different thread methods in java appeared first on Coding Security.


What are the different thread methods in java
read more

Tidak ada komentar:

Posting Komentar