Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132930 views
License: OTHER
1
import java.util.LinkedList;
2
3
public class Main {
4
public static void main(String[] args) {
5
LinkedList<? super Apple> apples = new LinkedList<Fruit>();
6
apples.add(new Apple());
7
8
// I can't get apples out
9
for (Object o : apples) {
10
Apple a = (Apple) o;
11
System.out.println(a);
12
}
13
}
14
}
15
16