package thread;
public class TestThread13 {
public static void main(String[] args) throws InterruptedException {
synchronized (TestThread13.class) {
Thread th = new Thread(new A());
th.start();
th.join(100);
System.out.println("主线程企图进入");
synchronized(A.class){
System.out.println("主线程进入了A.class锁");
}
}
}
}
class A implements Runnable{
@Override
public void run() {
synchronized (A.class) {
System.out.println("副线程企图进入");
synchronized (TestThread13.class) {
System.out.println("副线程进入了TestThread13.class锁");
}
}
}
}