Content deleted Content added
→Object Creation with Wildcard: mention raw types |
m WP:CHECKWIKI error fix for #03. Missing Reflist. Do general fixes if a problem exists. - using AWB (11939) |
||
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<!--in special circumstances, see section below)--> as well as in method definitions, but not in the definition of a generic type.<ref name="gilad2004">{{
== Covariance for generic types ==
Unlike arrays (which are [[Covariance and contravariance (computer science)#Covariant arrays in Java and C#|covariant]] in Java), different instantiations of a generic type are not compatible with each other, not even explicitly: With the declaration <code>Generic<Supertype> superGeneric; Generic<Subtype> subGeneric;</code> the compiler would report a conversion error for both castings <code>(Generic<Subtype>)superGeneric</code> and <code>(Generic<Supertype>)subGeneric</code>.
Line 99:
== References ==
{{Reflist}}
* The Java Language Specification, Third Edition (Sun), ISBN 978-0-321-24678-3 http://java.sun.com/docs/books/jls/
* Java Tutorials, Lesson Generics http://download.oracle.com/javase/tutorial/java/generics/index.html
* Capturing Wildcards, http://bayou.io/draft/Capturing_Wildcards.html
* Typkompatibilität in Java http://public.beuth-hochschule.de/~solymosi/veroeff/typkompatibilitaet/Typkompatibilitaet.html#Joker (in German)
{{DEFAULTSORT:Wildcard (Java)}}
|