Let's pretend you've agreed with me.
Now back to the earlier example I've given.
Assuming the following statement is legal, n1 is now pointing to f1.
In the last post, I've already explained that n1 can contain elements that is of type Number or its subclasses. So this statement is legal, right?
Now I want to retrieve the element using f1 instead of n1. Since f1 is declared as LinkedList<Float>, I expect the elements in LinkedList<Float> f1 to be at least a Float type. Meaning when I retrieve the elements from f1, I could do something like this:
But something goes wrong here, the element retrieved from f1 is a Double object added by n1. How can a value of type Float point to a Double object?