java - Android How change the value of an element of ArrayList<Integer>()? -
I want to change the value of an element in the list.
I have tried this code:
from the list & lt; Integer & gt; Numbers = New Arreelist & lt; Integer & gt; (); Numeros.get (2) 12 =;
But this gives an error. Can someone please help me? Thank you.
You can use the method defined in the ArrayList class.
Answer Your question needs to be done simply by:
numbers.set (2, 12);
But , be careful with this. Index value must be index
IndexOutOfBoundsException
. Will crash with.
Comments
Post a Comment