O'Reilly logo
  • Mihai Ciocirlea thinks this is interesting:

Line 7 doesn’t compile because we can’t add a Sparrow to List<Bird>


Cover of OCP Oracle® Certified Professional Java® SE 8 Programmer II


Incorrect. You CAN add a Sparrow to a List<Bird> because Sparrow extends Bird. An actual good example is required here, like: You can't add a Sparrow to a List<Woodpecker>.