Search your topic in Java2share
Home > FAQs
eXTReMe Tracker


Multi Threading FAQs


Untitled Document

Q41.wait(), notify(), notifyAll() method can available in which class?
Ans. These methods are defined in Object class.

Q42.Why wait(), notify(), notifyAll() method defines in object class instead of Thread class?
Ans. These methods are defined in Object class but not in Thread because Threads are calling this method on the shared object.

Q43.If a waiting thread got notification then it will entered into which state?
Ans. It will entered into another waiting state to get lock.

Q44.In which method threads can release the lock?
Ans. Once a Thread calls wait() method it immediately releases the lock of that object and then entered into waiting state similarly after calling notify() method Thread releases the lock but may not immediately. Except these three methods( wait(), notify(), notifyAll() ) method Thread never releases the lock anywhere else.