4.5.1 - Bounded Wildcards
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 is the syntax for an upper bound wildcard?
💡 Hint: Look for the keyword 'extends'.
What kind of types can be used with a lower bound wildcard?
💡 Hint: Think of what superclass means.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does List<? extends Number> allow?
💡 Hint: Think about the subclasses!
Can you add elements to a List defined as List<? extends Number>?
💡 Hint: Consider how wildcards restrict adding elements.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Design a generic method that can accept a list of pets which are subclasses of a superclass, and also allow adding mammals to a list of animals.
💡 Hint: Consider what types you want to allow and what you need to insert.
How would you refactor a method that uses non-bounded types into one that effectively uses bounded wildcards?
💡 Hint: Identify where you need to read and write in your current implementation.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.