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 is true about Maps in relation to the Collection interface?

  1. Maps are a type of Collection

  2. Maps cannot use Collection interfaces

  3. Maps use Collection to store elements

  4. Maps directly extend Collection

The correct answer is: Maps use Collection to store elements

Maps in Java are a specialized type of Collection that store key-value pairs. While they do implement the Collection interface, they do so indirectly through another interface called Map, rather than directly. Therefore, they are not a type of Collection, but they do use Collection methods to store and manipulate their elements. Option A is incorrect because while maps are related to the Collection interface, they are not a type of Collection. Option B is not accurate because Maps do in fact use Collection interfaces. Option D is incorrect because it directly states that Maps extend Collection, which is not true.