Explain how do we allow one thread to wait while other to finish.
- The wait() method, notify() method, and notifyAll() method provide an efficient transfer of control from one thread to another.
- A thread can suspend itself using wait() method till a time another thread notifies.
- Thread groups are used to invoke methods which apply to all threads in the group.
- Using the join() method, one can allow one thread to wait while other to finish.
Syntax:Public final void join()
- An interrupted exception is thrown if another thread has interrupted current thread.