In this chapter, we will talk about checking whether a thread is alive at a point and about waiting for a thread to finish.
Java Thread API provides option to check whether a thread is running or not using the method ThreadObject.isAlive().
Join is used to wait a thread to finish. The join() method waits for a thread to die. It causes the currently running threads to stop executing until the thread it joins with completes its task. Join also provides a overridden method with wait time which when provided will wait for a maximum of given time for the thread to die.
You can find the source code of this chapter in the following GitHub repository.
https://github.com/afsalashyana/Java-...
Website:-
https://www.genuinecoder.com
#Multithreading
#GenuineCoder
#Java