aspose file tools*
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
Bookmark "Lock on Objects" Watch "Lock on Objects" 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?
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

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

Joined: May 02, 2006
Posts: 16
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
 
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