What is the role of `ReentrantLock` in thread safety in Java?
`ReentrantLock` prevents thread contention by forcing threads to wait for the lock to be released before they can proceed with execution.
Thatâ€™s partially correct. `ReentrantLock` helps manage thread contention, but it allows more advanced locking features such as fairness and interruptible lock acquisition.
Can you explain how `ReentrantLock` allows fair locking and what that means in a multithreaded context?