Sun Oct 21, 2012 1:22 pm
import java.util.ArrayList;
import java.util.Iterator;
public class ArraysWork {
public static void main(String[] args) {
ArrayList charsList = new ArrayList();
for (char alphabet = 'A'; alphabet < 'H'; alphabet++) {
charsList.add(alphabet);
}
Iterator iterator1 = charsList.iterator();
while (iterator1.hasNext()) {
System.out.print(iterator1.next() + " \n");
iterator1.remove();
}
Iterator iterator2 = charsList.iterator();
while (iterator2.hasNext()) {
System.out.print("The array is not empty");
}
}
}
A
B
C
D
E
F
G
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.