Let's say I have a synchronized method on some class:
abstract class Foo {
public synchronized void foo() { // synchronized!
// ...
};
}
and I overrode it without using the synchronized modifier:
class Bar extends Foo {
@Override
public void foo() { // NOT synchronized!
super.foo();
// ...
}
}
I have a couple of specific question regarding this scenario:
- Will the overridden method be implicitly synchronized as well?
- If not, will the
super
-call be synchronized? - If there is no
super
-call, will anything be synchronized? - Is there a way to force an overriding method to use
synchronized
(I noticed that abstract method definitions or method definitions inside an interface don't allow the synchronized keyword)?