Hi ,
Books says that
List<?>, which is the wildcard <?> without the
keywords extends or super, simply means "any type." So that means any type of
List can be assigned to the argument.
And using the wildcard alone, without the keyword super (followed by a type), means that you cannot ADD anything to the list referred to as List<?>
But the following code compiles fine.
List<?> c1 = new ArrayList<
String>();
c1.add(null);
Why this works? Shouldn't it give error on add() method itself?
-Vivian