The ______ method of the Lock interface is used to acquire the lock.
- acquire()
- lock()
- tryLock()
- unlock()
The lock() method of the Lock interface is used to acquire the lock. It blocks until the lock is available and then acquires it. The unlock() method is used to release the lock. The acquire() and tryLock() methods are not part of the standard Lock interface in Java.
Loading...
Related Quiz
- Imagine you are developing a multi-threaded application for a bank. How would you ensure that when multiple threads are trying to update the same account, the account data remains consistent?
- What symbol is used in the syntax of a Lambda expression in Java?
- What is the worst-case time complexity of the Quick Sort algorithm?
- Which class would you use for reading binary data from a file?
- How can you read data from a URL using Java?