title: Tips to prevent deadlocks in java
body: <p>I am studying java threads and deadlocks, I understand deadlock's examples but I wonder if there are general rules to follow to prevent it.</p>
  
  <p>My question is if there are rules or tips that can be applied to the source code in java to prevent deadlocks? If yes, could you explain how to implement it?</p>