How to Storing an Array String, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to Storing an Array String,

that we can use it also to adding or swaping or deleting that Array

19th Mar 2017, 8:37 AM
Gema Isya Luthfi Prathama
Gema Isya Luthfi Prathama - avatar
1 Answer
+ 14
An String[] isn't dynamic (elements cannot be added or removed after init, only changed or set to "" - the length of an array cannot be changed). Go for ArrayList (add, remove for single elements, clear to remove all elements). You need an iterator to remove elements: http://stackoverflow.com/questions/10714233/remove-item-from-arraylist
19th Mar 2017, 11:59 AM
Tashi N
Tashi N - avatar