tag:blogger.com,1999:blog-4308013622076138636.post596631601389623100..comments2023-09-17T11:04:07.201-04:00Comments on Android Java J2EE Hibernate Spring: wait(), notify() and notifyAll()Anonymoushttp://www.blogger.com/profile/07342379000555562348noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4308013622076138636.post-35775694556231493082010-06-22T01:30:49.350-04:002010-06-22T01:30:49.350-04:00Why these methods are in Object class and not in T...Why these methods are in Object class and not in Thread class?Deepakhttp://www.blogger.com/profile/00814244461605314076noreply@blogger.comtag:blogger.com,1999:blog-4308013622076138636.post-81260124248561783592010-06-29T04:44:29.530-04:002010-06-29T04:44:29.530-04:00Hi Deepak,The answer is that Threads can use Objec...Hi Deepak,<br><br>The answer is that Threads can use Objects to transmit messages from one thread to another, and these methods allow that to happen. A Thread calls wait() to say "I am waiting for a message to be sent to this object." Another thread can call notify() to say "I am sending a message to that object." The Object is therefore a conduit through which threads communicate without explicitly referencing each other. If the methods were in the Thread class, then two threads would need to have references to one another to communicate. Instead, all communicating threads just need to agree to use some specific shared resource.Sharadhttp://www.blogger.com/profile/15754738523226225552noreply@blogger.com