jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Object Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Object Class" Watch "Object Class" New topic

Object Class

Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
why wait(),ntify() and notifyAll() methods included in Object Class

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927


Jacquie Barker
Ranch Hand

Joined: Dec 20, 2000
Posts: 201
It has to do with a concept called synchronization. Java is a multi-threaded language, meaning that a program can be written so that multiple processing "threads" can run simultaneously on a multi-processor machine; on a single processor machine, the JVM interleaves the various threads to make them appear to be running simultaneously.
At any rate, if there is a piece of code (a method)or an object that cannot safely be shared by more than one thread at the same time, we can do what is called "syncronizing" on that object or method so that it is GUARANTEED that only one thread can be accessing/affecting it at any given time.
These methods have to do with giving an Object the capability to be synchronized upon.
Hope this helps!

Author of Beginning Java Objects, Beginning C# Objects, and Taming the Technology Tidal Wave
I agree. Here's the link: http://aspose.com/file-tools
subject: Object Class
It's not a secret anymore!