import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class while1 {
public static void main(String[] args) {
List l = new ArrayList();
for (int i = 10; i <= 50; i += 10) {
l.add(i);
}
Iterator it = l.iterator();
System.out.println("while loop");
while (it.hasNext()) {
System.out.print(it.next() + "\t");
}
Iterator it1 = l.iterator();
System.out.println("\ndo .. while");
do {
System.out.print(it1.next() + "\t");
} while (it1.hasNext());
}
}
If 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.