What happens when the join() method is called on a thread?

  • The calling thread will wait for the specified thread to finish.
  • The specified thread will be paused but continue executing later.
  • The specified thread will be terminated immediately.
  • The specified thread will wait for the calling thread to finish.
When the join() method is called on a thread in Java, the calling thread will wait for the specified thread to finish its execution. This is often used to ensure that a thread completes its task before the calling thread proceeds. It's a mechanism for thread synchronization.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *