aspose file tools*
The moose likes Beginning Java and the fly likes A question on wait(). Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A question on wait()." Watch "A question on wait()." New topic
Author

A question on wait().

Ruchika Kapoor
Greenhorn

Joined: Oct 03, 2004
Posts: 22
Why do we have wait() in Object class rather than in Thread class.

Thanks,
Ruchika
rakesh sugirtharaj
Ranch Hand

Joined: Dec 16, 2007
Posts: 151
Imagine that you are standing in a crowd to meet a VIP one-on-one. Everyone is rushing in to meet him/her. Now who should say - "Hey!wait.. come in a queue" ?? You(i mean, one of the waiting people) or the VIP(or his/her bodyguards) ?? Similar case for object and threads. Many threads try to access the object and only the object says - wait or next(notify). Pretty good question actually


Cheers!
RSR
Dragan Stankovic
Ranch Hand

Joined: Oct 14, 2008
Posts: 33
I like your example. I'll use it for sure when asked to explain wait()


http://www.expertaya.com
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39388
    
  28
Originally posted by Dragan Stankovic:
I like your example.


Yes, it is a nice analogy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A question on wait().