For example:
String[] someArray = {null, "I want to start from here", "other element", "other element"};
for(int i = 1; i < someArray.length; i++)
{
System.out.println(someArray[i]);
}
Is there way to set the inital index of an array other than setting the first element to null?
In the for loop, I want to set i = 1.
There is no way to set the initial index of an array: it still has a 1st (index 0) element, it just happens to be
nullin your case. You can always start iterating from whatever index you want, but you’ll be wasting space.You could always make your own class…
And use it…
But why would you need that in the first place?