package
javaRadarArrayList;
import
java.util.ArrayList;
import
java.util.Iterator;
public class ItrTraversal {
public static void main(String[] args) {
//create Array
List
ArrayList<String>
javaRadarList = new
ArrayList<String>();
//Add elements
to ArrayList
javaRadarList.add("Java");
javaRadarList.add("Jquery");
javaRadarList.add("Spring");
javaRadarList.add("Hibernate");
javaRadarList.add("EJB");
//creating
iterator to traverse over javaRadarList
Iterator<String>
listIterator = javaRadarList.iterator();
while(listIterator.hasNext()){
System.out.println(listIterator.next());
}
}
}
OUTPUT:
Java
Jquery
Spring
Hibernate
EJB
No comments:
Post a Comment