import java.util.*; public class ArrayListExample { public static void main(String[] args) { /* ARRAY */ // construct an empty array of strings String[] arr = new String[6]; arr[0] = "According"; arr[1] = "to"; arr[2] = "known"; arr[3] = "laws"; arr[4] = "of"; arr[5] = "aviation"; System.out.println("arr = " + arr); /* ARRAYLIST */ // construct an empty list of strings // Client ArrayList list = new ArrayList(); // add words to the list list.add("According"); list.add("to"); list.add("known"); list.add("laws"); list.add("of"); list.add("aviation"); // whoops, forgot a word list.add(2, "all"); System.out.println("list = " + list); } }