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.


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.