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.


What does List<?> mean?

  1. A list of Objects

  2. A raw list type

  3. A non-raw list of a specific unknown type

  4. A list without any type

The correct answer is: A non-raw list of a specific unknown type

A) A list of Objects is not the same as a list of a specific unknown type. A list of Objects allows for any type of Object to be added to the list, while List<?> only allows for a specific unknown type to be added. B) A raw list type is not the same as List<?>. A raw list type does not have the type specified, whereas List<?> has a specific unknown type specified. D) A list without any type is not the same as List<?>. List<?> denotes a specific unknown type, whereas a list without any type can have any type of Object added to it. List<?> denotes a non-raw list of a specific unknown type. This means that the type of objects in the list is unknown, but the list itself is not a raw type. This allows for type safety while still being able to work with different types of objects