abstract class Basic (){
public synchronized void basicMethod(String string){
//Some actions here
}
}
public class A extends Basic{
public void aMethod(){
//Some actions here
}
}
public class B extends Basic{
public void bMethod(){
//Some actions here
}
}
Basic a = new A();
Basic b = new B();
a.basicMethod(); // acquires lock
b.basicMethod(); //Same lock?
换句话说 - 锁与具体的 Object 或 Super 类相关也很重要吗?