1import java.util.ArrayList;
2import java.util.Arrays;
3
4public class ArrayListExample
5{
6 public static void main(String[] args)
7 {
8 ArrayList<String> list = new ArrayList<>(Arrays.asList("alex", "brian", "charles", "dough"));
9
10 String firstName = list.get(0); //alex
11 String secondName = list.get(1); //brian
12
13 System.out.println(firstName);
14 System.out.println(secondName);
15 }
16}
17