import java.util.*;
public class iterator1 {
public static void main(String[] args) {
List list = new ArrayList();
int ar[] = { 11, 22, 33, 44, 55 };
for (int i = 0; i < ar.length; i++) {
list.add(ar[i]);
}
Iterator i = list.iterator();
while (i.hasNext()) {
System.out.print(i.next() + "\t");
}
}
}
Output
11 22 33 44 55If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.