Why might you use List<? extends Object> instead of List<?>?

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!

List<?> and List<? extends Object> essentially have the same meaning, as both are wildcard types that can store any type of objects. Therefore, there is no practical difference in using one over the other. Option A is incorrect because the keyword "extends" is not necessary when using the wildcard "?". Option B is incorrect as both options allow for the addition of any object type to the list. Option D is incorrect because the usage of wildcard types is not related to differentiating from raw types in method signatures.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy