Content deleted Content added
m →Covariance for generic types: fixed incorrect preposition; added required indefinite article |
m →Wildcard as parameter type: corrected non-standard [over]use of prepositions |
||
Line 9:
== Wildcard as parameter type ==
In the body of a generic unit, the (formal) type parameter is handled like its [[bounded quantification|upper bound]] (expressed with <code>'''extends'''</code>; <code>Object</code> if not constrained). If the return type of a method is the type parameter, the result (e.g. of type <code>?</code>) can be referenced by a variable of the type of the upper bound (or <code>Object</code>). In the other direction, the wildcard fits
<source lang="java5">
|