File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lock on Objects

 
Seth Anshul
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does each Object in Java has a corresponding lock?
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The lock field in the Object class is for multi-threaded programming. Using an object's lock is sometimes necessary to keep data from becoming corrupted when there are multiple threads sharing the same objects.

I consider multi-threading to be a fairly advanced aspect of Java.

http://java.sun.com/docs/books/jls/second_edition/html/memory.doc.html
[ February 19, 2008: Message edited by: Kaydell Leavitt ]
 
Seth Anshul
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kaydell.

Ulf, multiple post was not the intention.My net connection broke, thus leading to it.

Asset :roll:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic