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

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

Question: 1 / 515

What is true about Maps in relation to the Collection interface?

Maps are a type of Collection

Maps cannot use Collection interfaces

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.

Maps directly extend Collection

Next

Report this question