import java.util.ArrayList;
import java.util.List;
public class MainClass {
public static void main(String[] argv) {
// The index of each subsequent element is increased by 1, so indices remain
// sequential.
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
for (String s : list) {
System.out.println(s);
}
}
}
|