wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait() method question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wait() method question" Watch "wait() method question" New topic
Author

wait() method question

ujjawal rohra
Ranch Hand

Joined: Mar 20, 2010
Posts: 105


Can anyone explian that the wait method is called on an instance of t or on an instance of Trd ??? I cant understand


SCJP 6
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

t is not a class, its just a reference variable of Thread class. The wait method is called on the Instance of Trd class which you pass into the Thread class constructor. When you call the start method, Thread class calls the run method of your Trd class...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

Can anyone explian that the wait method is called on an instance of t or on an instance of Trd ???

When the thread t encounters the call to wait() method it will stop (or wait for another thread to execute notify() or notifyAll() on the same object that is instance of the Trd class in this case) executing, you will see yourself if you run the code.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wait() method question