String[] anArray = new String[20];
ArrayList<String> aList = new ArrayList<>(20);
aList.set(index, "Hi Mom!");
//The method set is used to change the value of
//existing elements, not to set them for the first time.
String temp = anArray[index]; //get element
String temp = aList.get(index);
To set an element for the first time, you use the method add.