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

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

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

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.


In generics, what does the '?' symbol represent?

  1. Any class that extends Number

  2. A specific type that must be defined

  3. An unknown type, also known as a wildcard

  4. A Boolean value indicating the presence of a type

The correct answer is: An unknown type, also known as a wildcard

The '?' symbol in generics represents an unknown type, also known as a wildcard. This allows for greater flexibility in defining type parameters and allows methods to be used more generally. Option A is incorrect because it is a limited definition and only includes classes that extend Number. Option B is incorrect because it contradicts the purpose of utilizing a wildcard in generics. Option D is incorrect because it does not accurately describe the purpose of the '?' symbol in generics.