Which statement is true?
Which statement is true?
The correct statement is that the tryLock() method returns a boolean indicator immediately regardless of whether it has managed to acquire the lock. The tryLock() method is designed to attempt to acquire the lock immediately, returning true if successful and false otherwise, without waiting. This behavior is distinct from the lock() method, which does not return a value immediately.
D is correct, you can read more about it here: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html#tryLock-- the lock() method doesnt return anything, so A and B are wrong. tryLock() always returns a boolean immediately, no waiting involved. returns True immediately if and only if the thread is available and successfully locked, otherwise false.