homework7 Version 0 |
|
👤 Author: by 1079513613qqcom 2020-12-15 05:58:30 |
public class DieLock {
public static Object t1 = new Object();
public static Object t2 = new Object();
public static void main(String[] args){
new Thread(){
@Override
public void run(){
synchronized (t1){
System.out.println("Thread1 get t1");
try {
Thread.sleep(100);
}catch (Exception e){
}
synchronized (t2){
System.out.println("Thread2 get t2");
}
}
}
}.start();
new Threa