Iterator
Wednesday, 22 June 2011
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class IteratorArray {
public static void main(String[] args) {
ArrayList a=new ArrayList();
for(int i=0;i<15;i++){
a.add(i);
}
Iterator i=a.iterator();
while(i.hasNext()){
System.out.println(i.next());
}
}
}
import java.util.Iterator;
import java.util.List;
public class IteratorArray {
public static void main(String[] args) {
ArrayList a=new ArrayList();
for(int i=0;i<15;i++){
a.add(i);
}
Iterator i=a.iterator();
while(i.hasNext()){
System.out.println(i.next());
}
}
}
0 comments:
Post a Comment