OnJava8-Examples/generics/SuperTypeWildcards.java

12 lines
292 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
// <20>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
}
2015-09-07 11:44:36 -06:00
}