import java.util.*;
public class Ex_ArrayList{
public static void main(String args[]){
ArrayList as = new ArrayList();
as.add("CCCD");
as.add("ACDE");
as.add("ADEF");
ListIterator it = as.listIterator();
while(it.hasNext()){
int index = it.nextIndex();
String data = (String) it.next();
System.out.println(index+" "+data+"\n");
}
}
}
0 CCCD
1 ACDE
2 ADEF
沒有留言:
張貼留言