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.
Loading...
Related Quiz
- What will happen if an exception is not caught by any catch block?
- Which method is used to properly stop a JavaFX application?
- If you do not specify any access level modifier, the default access level will be ________.
- What is the impact of declaring a constructor private in a class?
- The method replace(oldChar, newChar) belongs to the ________ class in Java.