How does multi-threading work in Java, and what strategies do you use to prevent concurrency issues like deadlocks?