Can Java object be locked down for exclusive use by a given thread?

Q

Can Java object be locked down for exclusive use by a given thread?

✍: Guest

A

Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.

2012-06-11, 2337👍, 0💬