package chapter6;

import java.util.ArrayList;
import java.util.Iterator;

public class Example3 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList();
        list.add("A");
        list.add("B");
        list.add("C");
        list.add("D");

        Iterator<String> iterator = list.iterator();
        // Iterator> iterator = list.iterator();
        while (iterator.hasNext()) {
            String item =  iterator.next();
            // String item =  (String) iterator.next();
            System.out.println(item);
        }
    }
}
