This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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: 39578
    
  27
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 - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lock on Objects
 
Similar Threads
synchrinized code doubt
thread's
a simple question of Locking mechanism
Lets play a word game...
WA #1.....word association