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

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

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


Which of these is not a direct subtype of Collection?

  1. Set

  2. List

  3. Queue

  4. Map

The correct answer is: Map

All of the options are subtypes of Collection except for D Map. A Set is a subtype of Collection because it allows for multiple unique elements to be stored and does not allow for duplicates. A List is a subtype of Collection because it allows for a sequence of elements to be stored and allows for duplicates. A Queue is a subtype of Collection because it stores elements in a first-in, first-out manner. However, a Map is not a subtype of Collection because it does not store elements in a collection-like manner, but rather stores entries in a key-value pair format.