aspose file tools*
The moose likes Beginning Java and the fly likes Lock on Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Lock on Objects

Seth Anshul
Greenhorn

Joined: May 02, 2006
Posts: 16
Why does each Object in Java has a corresponding lock?
What is the utility of having such a functionality.
Amit Y Desai
Ranch Hand

Joined: Dec 06, 2007
Posts: 35
Well..locks are used to obtain lock on any object.As simple as that...

seee when multiple threads are working on a single object and you want to synchronize then each thread should obtain lock on object before operating...
it is same as monitor concept in operating systems...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
Seth,

please don't post the same question multiple times. If you need to edit a post, click the little paper-and-pencil icon ().

Let's continue the discussion in this duplicate post.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lock on Objects