Wildcard (Java): Difference between revisions

Content deleted Content added
Wildcard as parameter type: contrast with concrete parameterization
Line 40:
<code>Generic<? '''super''' SubtypeOfUpperBound> referenceConstrainedFromBelow;</code>
 
can hold instantiations of <code>Generic</code> with anytypes supertypethat (e.g.are both subtypes of <code>UpperBound</code>) and supertypes of <code>SubtypeOfUpperBound</code>. (SuchThe atype wildcardbounds stillare hastrivial anexamples implicitthat upper bound of <code>Object</code>conform.)
 
It is even possible to constrain a reference's compatibility from both sides: from above by a generic class or method definition (<code><SubtypeOfUpperBound '''extends''' UpperBound></code>), or from below by the reference declaration (<code><? '''super''' SubtypeOfUpperBound></code>).
 
== Object Creation with Wildcard ==