Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What makes CyclicBarrier different from CountDownLatch?

  1. CyclicBarrier can be reset.

  2. CyclicBarrier cannot be used for thread synchronization.

  3. CountDownLatch allows tasks to run in parallel.

  4. CountDownLatch count can be incremented.

The correct answer is: CyclicBarrier can be reset.

A CyclicBarrier can be reset, meaning that it can be reused for a new set of tasks after the barrier has been reached. This is different from a CountDownLatch, which can only be used once and cannot be reset for another set of tasks. Option B is incorrect because CyclicBarrier and CountDownLatch both can be used for thread synchronization. Option C is incorrect because CyclicBarrier and CountDownLatch both allow tasks to run in parallel. Option D is incorrect because only the initial count of CountDownLatch can be set, but it cannot be incremented further.