Created
October 15, 2014 14:53
-
-
Save rzwitserloot/8af1e3f3bc3117b53106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Kiwi> listOfKiwis = new ArrayList<Kiwi>(); | |
list.add(new Kiwi()); | |
List<Fruit> listofFruits = listOfKiwis; // This line would actually fail to compile. | |
listOfFruits.add(new Apple()); | |
for (Kiwi kiwi : listOfKiwis) { | |
// ... this will blow up, there's an apple in my kiwis. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment