This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes mains says :Hey thread jon me !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "mains says :Hey thread jon me !!!" Watch "mains says :Hey thread jon me !!!" New topic

mains says :Hey thread jon me !!!

Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
Well, i read that , if we write t1.join() in a main method() where t1 is an instance of thread, then it implies

1. main thread would be moved from Running state to Blocked state with guarantee and would wait for an event of completion of t1 thread.

Problem :- Suppose , i want to say in some thread that join main, then how to do so ???

Thanks !!!

SCJP 6.0 96%

(Connecting the Dots ....)
Ankit Garg

Joined: Aug 03, 2008
Posts: 9400

In that case that other thread will need the main thread's instance to call join on. Something like this

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
Thanks Ankit....
Great explanation !!!
subject: mains says :Hey thread jon me !!!
It's not a secret anymore!