// Simple example of using an interface to write general code that can be // applied to two types of objects that both implement an interface known as // IntList. public class ListClient { public static void main(String[] args) { IntList list1 = new ArrayIntList(); processList(list1); IntList list2 = new LinkedIntList(); processList(list2); // error to say: // IntList list3 = new IntList(); } // do some basic manipulations with a list public static void processList(IntList list) { list.add(18); list.add(27); list.add(93); System.out.println(list); list.remove(1); System.out.println(list); } }