What is the difference between `synchronized` and `ReentrantLock`?
`synchronized` is a built-in keyword in Java that provides a simpler way to handle synchronization, while `ReentrantLock` is more flexible and offers additional features like try-lock and timed lock.
Exactly! `ReentrantLock` provides more flexibility, but `synchronized` is easier to use in simpler cases.
Can you explain when you might prefer using `ReentrantLock` over `synchronized`?