Let’s look at this definition:
public class Extend1<T, E> extends MyGeneric<T, E> {}
Here T
and E
are each present twice and in two different roles
- in
Extend1<T,E>
you define type arguments. This means that the typeExtend1
has two (unbounded) type argumentsT
andE
. This tells the Java compiler that those who useExtend1
need to specify the types. - in
extends MyGeneric<T,E>
you use the previously defined type arguments. IfT
andE
were not known to be type arguments here, thenT
andE
would be simple type references, i.e. the compiler would look for classes (or interfaces, …) namedT
andE
(and most likely not find them).
Yes, type arguments follow the same syntactic rules as any other identifier in Java, so you can use multiple letters ABC
or even names that can be confusing (using a type argument called String
is legal, but highly confusing).
Single-letter type argument names are simply a very common naming strategy.