public static void main(String[] args) { List extends Object> mylist = new ArrayList(); mylist.add(\"Java\"); // compile error }
This works:
List super Object> mylist = new ArrayList(); mylist.add("Java"); // no compile error
From O'Reilly's Java Generics:
The Get and Put Principle: use an extends wildcard when you only get values our of a structure, use a super wildcard when you only put values into a structure, and don't use a wildcard you both get and put.