join() method in Java Thread : The join()
method of a Thread class allows the current thread to wait until the
thread in which it is called will die. Sometime a question is asked
in the interviews that How can we make sure main() is the last thread
to finish in Java Program? So the answer is here that the join()
method is give to the way to confirm that all the child threads are
finished execution before main thread terminated.
There are three overloaded join functions:
Get in contact with FindNerd's tech experts for various programming problems. Nowadays most of the queries asked by users is from java developer forum section
There are three overloaded join functions:
- public final void join(): This method pause the current thread until the thread on which it’s called is terminated.If in any case the current thread is interrupted It throws InterruptedException.
- public final synchronized void join(long millis):
This method is used to pause the thread on which it’s called to be
terminated(dead) or wait for specified milliseconds......
Get in contact with FindNerd's tech experts for various programming problems. Nowadays most of the queries asked by users is from java developer forum section
No comments:
Post a Comment