OnJava8-Examples/generics/SuperTypeWildcards.java
2015-09-07 11:44:36 -06:00

12 lines
292 B
Java

// generics/SuperTypeWildcards.java
// ©2015 MindView LLC: see Copyright.txt
import java.util.*;
public class SuperTypeWildcards {
static void writeTo(List<? super Apple> apples) {
apples.add(new Apple());
apples.add(new Jonathan());
// apples.add(new Fruit()); // Error
}
}