Re: class type paramaters
It doesn't make much sense to use instance-level generics without a class-level generic declaration.
For example:
Code java:
class ClassA
{
T b;
T getB(T param)
{
return b;
}
}
Is field b expected to be a generic type, or is there actually class T? There's no way to tell. You must specify a class generic in order to clarify this.
Code java:
class ClassA<T>
{
T b;
T getB(T param)
{
return b;
}
}
Now it's understood that T is a generic type, and every instance of T should be replaced by the actual type.