cognizant : wait() notify() notifyAll() are belongs to Thread then why they are placed on Object Class ................. POLARIS: Diff b/w HashMap and ConcurentHashMap ....................... Birlasoft: 1.write Prime number program with minimum iterations. 2.Tell me count of each alphabet in given String using collections. 3. Scenario where to use 11EndPoint and 12EndPoint in SOAP.
wait() notify() notifyAll() methods works on the locks and locks are associated with Object and not Threads.Here one thread should call the another thread to woke up. In Java, the object itself is the entity that is shared between threads which allows them to communicate with each other. The threads have no specific knowledge of each other and they can run asynchronously. They run and they lock, wait, and notify on the object that they want to get access to. They have no knowledge of other threads and don't need to know their status. They don't need to know that it is thread2 which is waiting for the resource -- they just notify on the resource and whomever it is that is waiting (if anyone) will be notified.