How does a deadlock occur in Java?
A deadlock happens when two threads try to access the same resource in reverse order, causing them to wait on each other indefinitely.
Thatâ€™s partially correct. Deadlocks often occur when threads acquire multiple locks in different orders, but the reverse order is one of the common causes.
Can you explain how the `lock order` strategy can help prevent deadlocks?