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);

26th Jun 2019, 3:47 PM
Boy Arya
Boy Arya - avatar
2 ответов
+ 1
import java.util.ArrayList; import java.util.Iterator; it.hasNext() -> not HasNext x += it.next() -> x+ = gives an error
26th Jun 2019, 8:16 PM
Denise Roßberg
Denise Roßberg - avatar
0
Please look at the code. Hope it helps you 😉 https://code.sololearn.com/cGKSkpH1lVw2/?ref=app
26th Jun 2019, 4:46 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar