Junior — Senior
Creating a classic deadlock in Java
livecode
Task condition
Show a typical scenario of a deadlock situation, where two threads are permanently waiting for each other, each holding a different monitor in opposite order.
public class DeadLockDemo {
private static final Object lockA = new Object();
private static final Object lockB = new Object();
public static void main(String[] args) {
Thread t1;
Thread t2;
}
}