Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join() method of thread

 
Mohan Ramanna
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone throw liht on the join () method of thread.
a clear explanation is expected?
thanks in advance
- mohan
 
Prasanna Joshi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In javadoc --
Waits for this thread to die.
Practically a use of join is to block until the thread
completes it operation ie if u start a thread in main()
and u want the main to block until the thread completes
it operation.you can use join,so when the thread completes
it run ie dies,it unblocks the execution of main()
eg public static void main(String [] args)
{
Thread t = new Thread();
t.start();
t.join();
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic