Mike The lock, in this case, is on the object refered to by the object variable. Once it enters the synchronized block it gets the lock associated with that object and holds it until it leaves the block. As soon as it leaves the block the lock is released. hope that helped
Maybe it's worth amplifying Dave's point: the lock is released as soon as the thread leaves the block, regardless of how it leaves it. Whether it leaves it because the thread moves beyond the last curly brace, or because of a return (as in your code), a break, continue, or an exception, the lock is released. - Peter
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Those are the largest trousers in the world! Especially when next to this ad:
a bit of art, as a gift, that will fit in a stocking