Content deleted Content added
→Covariance for generic types: mention bounds |
name reference |
||
Line 1:
The '''wildcard''' <code>?</code> in [[Java (programming language)|Java]] is a special [[type parameter]] that controls the type safety of the use of [[Generics in Java|generic]] (parameterized) types. It can be used in variable declarations and instantiations as well as in method definitions, but not in the definition of a generic type.<ref name="gilad2004">{{cite|title=Generics in the Java Programming Language|url= http://www.oracle.com/technetwork/java/javase/generics-tutorial-159168.pdf|author=Gilad Bracha|date=June 2004|section=4. Wildcards|accessdate=6 March 2016}}</ref><ref>{{cite|url=http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.1.2|title=Java Language Specification|section=8.1.2 Generic Classes and Type Parameters|publisher=Oracle|accessdate=6 March 2016}}</ref> This is a form of ''use-site'' [[variance annotation]], in contrast with the ''definition-site'' variance annotations found in [[C Sharp (programming language)|C#]] and [[Scala (programming language)|Scala]].
== Covariance for generic types ==
|