Hi Peter,
Technically, what you say is true. Since the
List is a list of
Bird, we could add instances of
Sparrow to it (because of inheritance). So, while the surrounding explanation is correct, the sentence you mention has to be understood this way:
Line 7 doesn't compile because at compile time Java doesn't know what the real type of the list is (it could be Bird, Sparrow, or even another subclass of Bird or Sparrow)
And you agree that if
Parrot is another subclass of
Bird (next to
Sparrow), then I can't possibly add an instance of
Sparrow to it.
But you're right, while
Java doesn't allow that, it should be clearer as to why it doesn't.
Guillaume