When a thread tries to access a synchronized block of code in an object, it must first obtain the ________ on the object.

  • Lock
  • Monitor
  • Semaphore
  • Semaphore
When a thread tries to access a synchronized block in Java, it must first obtain the "Lock" on the object. This ensures that only one thread can execute the synchronized code block at a time, preventing race conditions.
Add your answer
Loading...

Leave a comment

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