1

Why is "this super" not allowed in a Java class method definition? For example,

class Dog{
  public <T super Dog> void display(ArrayList<T> t){
     t.add()
  }
}
Bathsheba
  • 220,365
  • 33
  • 331
  • 451
  • 4
    [that might be wort a read](http://stackoverflow.com/a/4343547/1799530) – SomeJavaGuy Mar 16 '17 at 10:49
  • 1
    Possible duplicate of [Difference between super T> and extends T> in Java](http://stackoverflow.com/questions/4343202/difference-between-super-t-and-extends-t-in-java) – S.L. Barth Mar 16 '17 at 10:50

1 Answers1

0

Because super of a class is always Object class so it means it act as
public &ltObject&gt void display(ArrayList <Object> t)
{}

And it allow every class object to pass in display function parameter which is not good for genrics.So that's why super is not allow in function definition there.