Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListListIteratorExample2 { ArrayList
arrlist = new ArrayList
(); arrlist.add("d"); arrlist.add("dd"); arrlist.add("ddd"); arrlist.add("dddd"); arrlist.add("ddddd"); System.out.println(arrlist); // [d, dd, ddd, dddd, ddddd] ListIterator
iterator = arrlist.listIterator(5); System.out.println(iterator.hasNext ()); // false iterator = arrlist.listIterator(6); // IndexOutOfBoundsException }
Output