Originally posted by Ramesh Sahu:
Yes I am aware of that.
Then why does the following code compile ?
import java.util.*;
class test
{
public static void main( String args[] )
{
List<? super String> list = new ArrayList <Object> ();
list.add(new String("HI"));
}
}
Because if you use the statament
<? super String> means anything in this list
CAN BE a String, so no problem on adding it. By the way, its the
only case you can add using wildcard.
[ July 29, 2008: Message edited by: Raphael Rabadan ]