下面两段代码有什么区别,有大神给答案吗,好像锁不同对象没什么区别啊
code 1
synchronized (A.class) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
code 2
synchronized (B.class) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
慕桂英3389331
千巷猫影
摇曳的蔷薇
拉风的咖菲猫
相关分类