I\'ve got a class Results
which extends ArrayList
. I\'ve got an object i
which has a function i.getResults()
w
Well, you're trying to assign an object of a superclass type to a reference of a subclass type, and of course that's a compile-time error, because it might not be valid. It's the same as if you tried to assign the return value of a method that returns Object
to a variable of type String
. If you are absolutely sure the getResults()
method returns a Results
object, you should change its return type. Or if you're only sure of it in this context, you can use a cast.