Abhi vijay wrote:But <? super String> means anything that is a super class of String can be added into the collection, Object is a superclass of String?
No. ? super String means that the List can be of any super type of String. It might be CharSequence, Serializable, Comparable etc or even String itself. So you are not sure about which type it is. But one thing is sure. The type is a super type of String. So you can store objects of String and it's sub-classes into the list. Since String is a final class, so you can store only String class's objects in the list...
list parameterized reference variable can refer to object parameterized with either <String> or Super class of String.
super just gives you flexibility of adding objects to it unlike extends where there is NO NO to add.
Now its clear, actually I was trying to mix up LINE1 AND LINE2.
List<? super String> list = new ArrayList<Object>(); // Line1.
Here on the Right hand Side , we can declare either String or any supertype of String, namely String,Serializable, CharSequence, Comparable<String>.