synchronized
方法的非 synchronized
方法。
如果超类方法声明为 synchronized
,重写的方法将不会自动同步。 这可能导致使用子类时出现意外的竞争条件。
示例:
class Super {
synchronized void process() {}
}
class Sub extends Super {
// 未同步的方法 'process()' 重写同步的方法
void process() {}
}