Hi.....
Ques: Hello all of you now i am work in java but i am not understand Which class is the wait() method defined in? please explain and solve below given a problem....
Which class is the wait() method defined in. I get incompatible return type for my thread’s getState( ) method.
Which class is the wait() method defined in?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 10, 2011, 7:46 PM EST
The
wait()method is defined in theObjectclass, which is the ultimate superclass of all others. So theThreadclass and anyRunnableimplementation inherit this method fromObject.The
wait()method is normally called on an object in a multi-threaded program to allow other threads to run. The method should only be called by a thread that has ownership of the object's monitor, which usually means it is in asynchronizedmethod or statement block.Thanks