Assume I want to declare an interface named A
which extends class List
.
What is the difference if I write as
A<E> extends List
or
A<E> extends List<E>
?
What is the difference between objects instantiated form these two classes?
The question remains about methods or classes with bounded type parameters. like
public <T extends aClass<T>> void methodName(T t)
and
public <T extends aClass> void methodName(T t)
.
CLARIFICATION:
I know what is raw type. Suppose we have this:
Class someClass<E> extends ArrayList
someClass
is subclass of ArrayList
, means it inherits all accessible fields and methods of ArrayList
.
I know if I replace ArrayList
with ArrayList<E>
, if I invoke someClass<String> object
it would pass String
to the super class which is ArrayList
and that's fine.
But let's stick with the code. Now if i invoke someClass<String> object
, it doesn't pass String
to the ArrayList
. So now, object is raw
or not and how its fields and methods work?