Content deleted Content added
m Robot - Speedily moving category Java programming language to Category:Java (programming language) per CFDS. |
→Wildcard as parameter type: missing initialization + other example of type error |
||
Line 22:
}
...
Generic<?> wildcardReference = new Generic<>();
UpperBound ub = wildcardReference.read(); // Object would also be OK
wildcardReference.write(new Object()); // type error
wildcardReference.write(new UpperBound()); // type error
((Generic<UpperBound>)wildcardReference).write(new UpperBound()); // OK
</source>
|