When a thread acquires a lock for a synchronized method, what happens to the other threads that are trying to access it?

  • They are paused and put into a waiting state until the lock is released by the thread that acquired it.
  • They are terminated abruptly.
  • They continue to execute concurrently without any impact.
  • They throw an exception immediately.
In Java, when a thread acquires a lock for a synchronized method, other threads that attempt to access the same synchronized method are paused and put into a waiting state. They will wait until the thread that acquired the lock releases it, allowing one thread to execute the synchronized method at a time.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *