Java SE 17 Developer — Question 17

Which statement is true?

Answer options

Correct answer: D

Explanation

The correct answer is D because the tryLock() method is designed to return a boolean value instantly to indicate whether the lock has been acquired or not, without blocking. Options A and B refer to the lock() method, which does not work in the same way, as it can block until the lock is available. Option C incorrectly describes the behavior of tryLock() by suggesting it can wait for lock acquisition, which it does not do.