Quick Answer
ReentrantLock provides more control than synchronized: tryLock() (non-blocking attempt with optional timeout), lockInterruptibly() (can be interrupted while waiting), fair mode (threads acquire in order of waiting), and separate Condition objects (like multiple wait/notify queues). More powerful than synchronized but more verbose. Prefer synchronized for simple cases, ReentrantLock for advanced scenarios.
Answer
Locks provide advanced synchronization features. ReentrantLock allows same thread to re-acquire lock. Supports fairness, tryLock, timed locking, and conditions.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.