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 List and List<?> in Java generics?

  1. They are completely the same

  2. List is raw type and List<?> is a wildcard type

  3. List<?> is raw type and List is a wildcard type

  4. They are unrelated types

The correct answer is: List is raw type and List<?> is a wildcard type

List and List<?> are both generic types in Java, however they are not entirely the same. Option A is incorrect because they do have some differences. Option C is incorrect because the wildcard symbol <?> indicates an unspecified type, therefore it cannot be a raw type. Option D is incorrect because both List and List<?> are related as they are both generic types. The correct explanation is that List is known as a raw type since it does not have any generic type arguments specified, while List<?> is a wildcard type which can represent any generic type.