Bookmark Topic Watch Topic
  • New Topic

Lock on Objects

 
Seth Anshul
Greenhorn
Posts: 16
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 42966
73
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic