I wrote the following in my class:
public class Test{
public static void main(String[] args){
List<? extends Number> list = new ArrayList<Integer>();
list.add(new Integer(5));
}
}
But this won't compile and gives an error:
error: no suitable method found for add(Integer)
list.add(new Integer(5));
I'm looking for a simple clarification of this problem.