Use the Iterator returned from ArrayList to loop through an array list
import java.util.ArrayList; import java.util.Iterator; public class MainClass { public static void main(String[] a) { ArrayList<String> nums = new ArrayList<String>(); nums.add("O"); nums.add("Two"); nums.add("Three"); nums.add("Four"); String s; Iterator e = nums.iterator(); while (e.hasNext()) { s = (String) e.next(); System.out.println(s); } } }