Add to the ArrayList using conditional statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Add to the ArrayList using conditional statement

I want to Add an element to an ArrayList using a interaction, while loop and if statement. I have a code below but it giving an error. Any modification I should do? https://code.sololearn.com/cIqMy7by8RHN/?ref=app

11th Oct 2017, 10:02 AM
Sibusiso Mbambo
1 Answer
+ 6
Iterator was used to traverse the list and it's not a list itself. However, you can add it into the ArrayList. 😉
11th Oct 2017, 10:08 AM
Zephyr Koo
Zephyr Koo - avatar