Hello I have question about ReentrantLocks in Concurrent package.
//First
Object ob = new Object();
synchronized(ob){
}
//Second
Lock lock = new ReentrantLock();
lock.lock();
try{
}
finally{
lock.unlock();
}
It says both Pieces of code are equivalent. What I don't get is in Fist piece synchronized block acquires the lock on obj object. But on what object does Reentrant lock acquire the lock on? Can I specify the object I want to lock on just like synchronized(obj)?