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
import java.util.List;
3
4
public class Main {
5
public static void main(String[] args) {
6
List<Fruit> myFruits = new LinkedList<Fruit>();
7
List<Apple> myApples = new LinkedList<Apple>();
8
9
myFruits.add(new Fruit());
10
myFruits.add(new Apple());
11
12
myApples.add(new Apple());
13
14
System.out.println(myFruits.getClass());
15
System.out.println(myApples.getClass());
16
myFruits = myApples;
17
}
18
}
19
20