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

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

Want to excel in Java? Test your knowledge with our ultimate quiz based on 'Thinking in Java'. Engage with multiple-choice questions and in-depth explanations. Boost your understanding and prepare for your exam with confidence.

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 does the List<?> declaration imply about the List's element type?

  1. The list can hold elements of any subtype of Object

  2. The list can only hold elements of the class List

  3. The element type is unknown and could be anything

  4. The list is of a specific generic type determined at runtime

The correct answer is: The element type is unknown and could be anything

A Option A is incorrect because the List does not necessarily hold objects of any subtype of Object. The wildcard "?" in the List<?> declaration does not necessarily extend Object. B: Option B is incorrect because the List does not necessarily hold elements of the class List. The wildcard "?" in the List<?> declaration does not necessarily extend List. D: Option D is incorrect because the List is not of a specific generic type determined at runtime. The wildcard "?" in the List<?> declaration means that the element type is unknown and can vary.