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()
}
}
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()
}
}
Because super of a class is always Object class so it means it act as
public <Object> 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.