This:
siddharth das wrote:public <? extends Animal> void takeThing(ArrayList<?> list)
and this:
siddharth das wrote:public void takeThing(ArrayList<T extends Animal> list)
both do not compile.
The first one doesn't because it's simply a syntax error - after the 'public' you can specify one or more type arguments between < and >, and a wildcard is not a type argument. A wildcard is not some kind of anonymous type argument.
The second one doesn't because you didn't specify that T is a type argument, so the compiler will expect that there is a type named 'T', which there isn't (unless you have a
class T { ... } or
interface T { ... } in scope).
A bit more about the second: Note that the convention is that type arguments are named with a single, upper-case letter, but this is just a common convention - the name of a type argument is just a name, and can be anything. If you don't specify the type argument between < and > after 'public', then the compiler cannot know if T is a type parameter or a concrete type. An example to make it more clear: