How to add an String[value] to String[] defined | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to add an String[value] to String[] defined

String[] a = {"value1","value2","value3"}; how do we adding another value to String[]a? and how to get value that was added to String[]a? so when we adding another value to String[]a the new value will fill to the next value of String[]a without Removing the value of String[]a.

20th Mar 2017, 6:48 PM
Gema Isya Luthfi Prathama
Gema Isya Luthfi Prathama - avatar
2 Answers
+ 7
You can append a value to the end, then get it using its place in the array (one added to the end would be gotten by a[3]
20th Mar 2017, 7:28 PM
J.G.
J.G. - avatar
+ 7
Keep in mind, though, that the size of an array can't be modified. It specifically has to be an array list.
20th Mar 2017, 7:31 PM
J.G.
J.G. - avatar