Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

Lock on Objects

 
Seth Anshul
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why does each Object in Java has a corresponding lock?
What is the utility of having such a functionality.
 
Amit Y Desai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic