File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread join method?

 
Ashish Anant Patil
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S.V.M{
Thread t=new Thread();
t.join;

please correct me if Iam wrong....It Means join Main behind tread t1...right???

and can we join any other thread behind t1...for say t2....and how???
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you read the API documentation for Thread.join()?

t.join(); means that the thread that you are making this call from (the main thread, for example) waits for thread t to stop.
 
Shahir Deo
Ranch Hand
Posts: 80
Hibernate Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
t.join() will run thread t and put all other threads in wait after it finishes the process the other threads can now run. InterruptedException is the exception which is thrown if thread t is interrupted by any other threads.
 
Nancy Avent
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shahir Deo wrote:t.join() will run thread t and put all other threads in wait after it finishes the process the other threads can now run. InterruptedException is the exception which is thrown if thread t is interrupted by any other threads.


I think, the description provided you is confusing and incorrect.

Due to statement t.join(), the main thread will wait till thread t completes.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic