Wildcard (Java): Difference between revisions

Content deleted Content added
m Replace magic links with templates per local RfC and MediaWiki RfC
Line 38:
This reference can hold any instantiation of <code>Generic</code> with an actual type parameter of <code>SubtypeOfUpperBound</code>'s subtype. A wildcard that does not have an upper bound is effectively the same as one that has the constraint <code>extends Object</code>, since all types implicitly extend Object. A wildcard with a lower bound
 
<code>Generic<? '''super''' SubtypeOfUpperBoundSubtypeOfLowerBound> referenceConstrainedFromBelow;</code>
 
can hold instantiations of <code>Generic</code> with any type that is both a subtype of <code>UpperBound</code> and a supertype of <code>SubtypeOfUpperBound</code>. The type bounds are trivial examples that conform.