Question 16
Back to Exercise
What does lock.tryLock(1, TimeUnit.SECONDS) allow?
- A Locking twice
- B Giving up if the lock is not available within a second – useful to avoid deadlock Correct
- C Unlocking automatically
- D Reading without locking
Correct Answer: Option B
It returns true if the lock was acquired.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!