15.10 - Wildcards in Generics
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does <?> represent in generics?
💡 Hint: Think about flexibility in type.
In the context of wildcards, what does 'extends' signify?
💡 Hint: Consider when reading types.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What wildcard allows any type?
💡 Hint: Think about 'flexibility'.
True or False: The syntax <? extends Number> allows reading elements that are of type Number or its subtypes.
💡 Hint: Think about types of numbers.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Write a method that accepts a list of any type using an unbounded wildcard and calculates the total number of items added to the list. How would you approach it?
💡 Hint: Focus on the size of the list.
Create a utility function that adds items of type T to a list that accepts upper bounded wildcards. Provide an example of its usage.
💡 Hint: Think of the method signature and its parameters carefully.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.