import java.util.ArrayList; public class WildcardDemo { public static void addAll(ArrayList lst, ArrayList other) // public static void addAll(ArrayList lst, ArrayList other) // doesn't work with Student array list { for (E e : other) { lst.add(e); } } public static > E max(ArrayList a) // public static > E max(ArrayList a) // doesn't work with Student array list { E largest = a.get(0); for (int i = 1; i < a.size(); i++) { if (a.get(i).compareTo(largest) > 0) { largest = a.get(i); } } return largest; } public static void main(String[] args) { ArrayList students = new ArrayList<>(); students.add(new Student("Fred", "CS")); students.add(new Student("Ann", "Bio")); students.add(new Student("Sue", "CS")); ArrayList people = new ArrayList<>(); people.add(new Person("Harry")); addAll(people, students); System.out.println(people); System.out.println(max(students)); } }