Java generics, wildcard? denotes unknown type, equivalent to <? Extends Object>,<? Extends t> is the upper boundary limited wildcard character, <? The Super T> is the next boundary qualified wildcard character.
First, the difference
In a list, the upper and lower bounds wildcard characters can be stored and read as shown in the type of object:
Second, the principle
The use of upper and lower bounds wildcard characters should follow the pecs principle: Producer extends,consumer Super.
Qualifying wildcard characters always include their own
Upper bound type wildcard: The Add method is limited
Nether Type Wildcard: Get Method Limited
If you want to get data from a data type, use the? Extends wildcard characters
If you want to write objects into a data structure, use the? Super wildcard characters
If you want to save and take it, don't use wildcards
You cannot declare both the upper and lower bounds of a generic wildcard
Reference:
Java generic <? Super T> How does super understand? How is it different from extends? -Chubby Answer-https://www.zhihu.com/question/20400700/answer/117464182
51943742
Upper and lower bound wildcard characters in Java generics