Yes.
NOTE: The rest is background knowledge about ArrayLists.
Let's say you want an ArrayList of Strings. Keep in mind Strings are Objects.
// Creates ArrayList
ArrayList<String> list = ArrayList<String>();
// Adds elements to ArrayList
list.add("Hello");
list.add("world!");
// Iterate through ArrayList
for (String str : list) {
// Print the String in the list.
System.out.print(str + " ");
}
// Print newline character.
System.out.print("\n");
The for (String str : list)
is a for each loop which allows you to iterate through each element in the list.