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
  • 231,907
  • 34
  • 361
  • 483

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.