Instinct Lock
Each of the object has a lock
by default, so we don't have to explicitly write a Lock
.
If we want to acquire lock, we can simply do
synchronized (obj) {
// do something with obj
}
Each of the object has a lock
by default, so we don't have to explicitly write a Lock
.
If we want to acquire lock, we can simply do
synchronized (obj) {
// do something with obj
}