Asked 3 years ago
15 Sep 2021
Views 720
Connor

Connor posted

How to set value in an array in Android?

I am new to java and android, want to initialize the new array and use it to store strings, so can someone help me to understand how to set Array in Android or java?

sachin

sachin
answered Sep 15 '21 00:00


Array.set() is used to set value at Array in Java and Android .
Array class provides static methods to dynamically create and access Java arrays.

        String s[] ;
         Array.set(s, 0, "test");


here Array.set() method have the first argument is the array object, the second argument is the index and the last argument is the value to set to that index
Post Answer