This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Lock on Objects

Seth Anshul

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

Joined: Mar 22, 2005
Posts: 41024

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
wood burning stoves
subject: Lock on Objects
Similar Threads
a simple question of Locking mechanism
synchrinized code doubt
WA #1.....word association
Lets play a word game...