public <? extends Animal> void takeThing(ArrayList<?> list)
public <T extends Animal> void takeThing(ArrayList<T> list)
Why this statement is wrong? I mean why the ?
can't be used in the front? But T
can. What is the difference?
Possible duplicate "When to use wildcards in Java Generics?"
Here is an answer for this question.But I don't get what this mean. "if you say void then there is no return type. if you specify then there is a return type. i didn't know that you can specify to have return type or no return type."