synchronized and ReentrantLock are both Java locking mechanisms for mutual exclusion, but ReentrantLock is a more flexible, explicit API that offers capabilities the simpler synchronized keyword doesn't provide.
A connection pool that wants to give up waiting for a lock after 500ms rather than blocking indefinitely would use lock.tryLock(500, TimeUnit.MILLISECONDS), something synchronized simply cannot express.
private final ReentrantLock lock = new ReentrantLock();
public void update() {
lock.lock();
try {
// critical section
} finally {
lock.unlock();
}
}A concise interview answer is
synchronized is simpler and safer by default since the JVM handles lock release automatically, even on exceptions. ReentrantLock trades that simplicity for more control — tryLock with timeouts, interruptible locking, fairness policies, and multiple conditions per lock — which matters for more advanced concurrency scenarios.
Last updated: 11 November 2026
Previous question: How does ConcurrentHashMap work internally?
Next question: What happens when an exception occurs inside a synchronized block?