← Quiz: Java Concurrency Utilities: all 10 questions
Quiz: Java Concurrency Utilities · Question 7 of 10
You want at most 3 threads to use the database at the same time. Which tool fits?
You want at most 3 threads to use the database at the same time. Which tool fits?
- A.CountDownLatch(3)
- B.AtomicInteger(3)
- C.CopyOnWriteArrayList
- D.Semaphore(3)
Answer & explanation
Correct answer: Semaphore(3)
A Semaphore hands out a fixed number of permits; acquire takes one and release returns it.
Can you get the rest right without peeking?
Take the timed Quiz: Java Concurrency Utilities quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →