← Quiz: Java Multithreading: all 10 questions
Quiz: Java Multithreading · Question 9 of 10
Which rule prevents the classic two-lock deadlock?
Which rule prevents the classic two-lock deadlock?
- A.Use more threads
- B.Call sleep() before taking a lock
- C.Make every method static
- D.Always take the locks in the same order in every thread
Answer & explanation
Correct answer: Always take the locks in the same order in every thread
If every thread locks A before B, no thread can hold B while waiting for A, so the circular wait cannot form.
Can you get the rest right without peeking?
Take the timed Quiz: Java Multithreading quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →