What is the output of the following code?
import java.util.*;
public class Geeks {
public static void main(String[] args) {
List<String> list = new ArrayList<>(Arrays.asList("A", "B", "C"));
Iterator<String> iterator = list.iterator();
while(iterator.hasNext()) {
System.out.print(iterator.next() + " ");
iterator.remove();
}
System.out.println(list.isEmpty());
}
}
A B C true
A B C false
A B C [A, B, C]
Compilation Error
This question is part of this quiz :
Java Iterators