-3

If we make a method synchronized then all the instance method will be locked while executing that method or only the other synchronized methods will be locked?

Surya
  • 604
  • 1
  • 6
  • 25

1 Answers1

0

Well, if the synchronized method is static then it will be synchronized for all instances, otherwise it will be synchronized for a specific object which called it. if 1 object tried to access the synchronized method and the object has two calls to that method then the second call can't be proceed until the first operation is done

Basil Battikhi
  • 2,638
  • 1
  • 18
  • 34