hello!
how are you?
i must forgot..is there a method to get a index of array?
say if array[3], can it tell me index is 3?
i need a way to get that integer inside of []...
That depends on how you access it. To control the index of the array, you can use it within a for-loop, like
for(int index = 0; index < array.length; index++)
{
//do something with array[index];
}
But if you supply for example array[2] to a function, you'll loose the array, but get the primitive of the array back. So, in your example you'll only get an int, and have lost the position within the array.
Before i forget, if you want to manipulate the array, you also can look to java.util.Arrays.
This class contains some functions for manipulating mainly primitive arrays.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.