Comprehension

Report a typo

What will happen if you run this code?

CopyOnWriteArrayList<Integer> onWriteArrayList = new CopyOnWriteArrayList<>();
onWriteArrayList.add(1);
onWriteArrayList.add(2);
onWriteArrayList.add(3);

Iterator<Integer> iterator = onWriteArrayList.iterator();

onWriteArrayList = null;

while (iterator.hasNext()) {
    System.out.print(iterator.next() + " ");
}
Select one option from the list
___

Create a free account to access the full topic