1 2 3 4 5 6 7 8 9 10 11 12
import java.util.*; public class SimpleGenericsUsage { public static void main(String[]argv) { ArrayList<String> fruits = new ArrayList<String>(); fruits.add("Oranges"); fruits.add("Apples"); fruits.add("Pears"); System.err.println(fruits.size()+" fruits defined"); } }