I\'m not sure why the last statement in the following code is illegal. Integer should be a subtype of ?, so why can\'t I assign it to b
Integer
?
b
It's because we cannot guarantee that Integer is a subtype of the parameter type "?".
Look this:
Object c = b.get(0);
This is valid, as ? will always be an subtype from Object.