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.


Which collection class allows duplicate elements?

  1. Set

  2. List

  3. Queue

  4. Map

The correct answer is: List

A Set does not allow duplicate elements since it adheres to the "unique keys" concept. C: Queue does not allow duplicate elements since it follows a FIFO (First-In-First-Out) structure. D: Map can have duplicate values, but not duplicate keys. B: List is the correct answer because it allows for duplicate elements. This is because list data structures do not have any restrictions on the number of times an element can appear. Therefore, you can have duplicate elements in a list.