Consider the Code below:
public static void main(
String[] ar)throws Error{
List<? super Object> a=new ArrayList<Object>(); add(a,new Object());
}
static <T> List add(List<T> L,T o){
return L;
}
Note the Highlighted Code. this Code compiles fine.if i change the line to
List<? extends Object> a=new ArrayList<Object>(); add(a,new Object());
It shows compliation error. I assume Object extends Object is true.Then why is the Compilation Error coming? Can anyone help me with this.