I have a class that extends the LinkedList class. Here\'s an excerpt of the code:
class SortedList extends LinkedList {
i
This is because you have
after SortedList
.
Usually you use T
for type parameters: class SortedList
, but you used Integer
instead. That is, you made Integer
a type parameter (which shadows the java.lang.Integer
).
Your class, as it stands, is equivalent to
class SortedList extends LinkedList {
int intMethod(T integerObject){
return integerObject; // <-- "Cannot convert from T to int"
}
}
Remove the type parameter and it works just fine:
class SortedList extends LinkedList {
int intMethod(Integer integerObject){
return integerObject;
}
}