posted 19 years ago
Because the type of list (java.util.LinkedList) is not assignable to java.util.ArrayList. That they share a common supertype hierarchy is superfluous to the issue - the list refers to a type java.util.LinkedList, and this type is not (emphasis, not) assignable to type java.util.ArrayList.
This is the plain vanilla example of failed casts and their effect, so the question really is "why do you not think it will fail?"
Tony Morris
Java Q&A (FAQ, Trivia)