Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What does the wildcard syntax '<? super T>' allow you to do?
Think about what the 'super' in the wildcard refers to.
In the context of wildcards, what does PECS stand for?
It's a mnemonic to help remember how to use wildcards.
What can you add to a List defined as List<? super Integer>?
Think about what 'super' means in terms of type hierarchies.
In what scenario is it most beneficial to use lower bounded wildcards?
Consider why you might want more flexibility in what can be added.
Write a Java method that uses lower bounded wildcards to allow adding elements of different shapes into a list. Describe the potential constraints.
Think about how shapes can be categorized. You can add circles and squares, but reading needs a specific type.
Imagine a scenario where you need to process different types of vehicles (cars, trucks, etc.). Write a method using lower bounded wildcards to manage these vehicle types.
Consider what happens when you try to read vehicles from the list. Can you guarantee their type?
4 more questions in this section. Enroll free to practise them all.
Enroll free