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 is used in Java to make unbounded wildcard parameter distinguishing from a raw type?

  1. <?>

  2. <AnyType>

  3. <T>

  4. <*>

The correct answer is: <?>

The unbounded wildcard parameter in Java, also known as the question mark or wildcard type, is used to represent an unknown type. This wildcard can be used in different contexts, such as in method signatures or generic classes, to specify that the type can be any kind of object. This is useful when the type is not important or unknown at the time of writing the code. In order to differentiate it from a raw type, which is a generic type without any type arguments, the unbounded wildcard is denoted by the symbol <?>. The other options are incorrect because they do not represent an unbounded wildcard type. Option B, <AnyType>, is not a valid syntax in Java, while option C, <T>, represents a bounded wildcard parameter with the type T. Option D, <*>, is not a valid symbol in Java and it is also commonly used as a multiplication operator. Therefore