0
Plz help me to fix the code below
ArrayList <Integer> list = new ArrayList <Integer>(); for(int i = 0; i < 6; i++) { list.add(i); } int x = 0; Iterator <Integer> it = list.iterator (); while (it.HasNext()) { x+ = it.next(); } System.out.println (x);
2 Answers
+ 1
import java.util.ArrayList;
import java.util.Iterator;
it.hasNext() -> not HasNext
x += it.next() -> x+ = gives an error
0
Please look at the code. Hope it helps you đ
https://code.sololearn.com/cGKSkpH1lVw2/?ref=app