Explain how do we allow one thread to wait while other to finish.
- 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 the current thread.
- The join() allows you to specify a maximum amount of time which you want to wait for the specified thread to terminate.