OnJava8-Examples/generics/SuperTypeWildcards.java

11 lines
251 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// generics/SuperTypeWildcards.java
2015-06-15 17:47:35 -07:00
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
}
2015-09-07 11:44:36 -06:00
}