示例:
abstract class Base {
synchronized void foo() {
// ...
}
}
class Derived extends Base {
@Override
void foo() {
super.foo()
// ...
}
}
在本例中,类 Bar
中的非 synchronized 方法 foo()
会改写 synchronized 方法。