Question 1:
Collection<?> c = new ArrayList<
String>();
c.add(new Object());
*******************************************************************
Question 2:
List<? super Integer> list = new ArrayList<Integer>();
list.add(1);
*******************************************************************
My question is why Question1 cannot be compiled. However, Question2 can be compiled and run.
I read a book and it says that all the situation using Wild Card is read-only.
Then, Why Question 2 still can be compiled?
Thanks a lot.