5

What happens when a method in super class is synchronized, but you override the method in a subclass and don't synchronize it ?

user2434
  • 6,339
  • 18
  • 63
  • 87

1 Answers1

5

If a method in super class is synchronized, but you override the method in a subclass and don't synchronize it, then the method is no longer synchronized if called on the subclass.

xagyg
  • 9,562
  • 2
  • 32
  • 29
  • 1
    Likewise, a subclass can add synchronization to a method that a superclass does not have synchronized. – Paul Jackson Jun 07 '13 at 13:48
  • 1
    If your subclass foo() method calls super.foo() then you will be synchronized during the super invocation. – Pace Sep 13 '13 at 13:12