Hi,
thanks for that, I ve one more question. I wanna know why the following programme giving me the output
00030?
I'm confused here
for(int i:arr)
{
arr[i]=0;
}
Is not i here referring to value 1, which is the index number of the array, and at the end of loop, i referring to 4, which result in
IndexOutOfBound Exception. And why the answer was 0030?
for(int i:arr)
{
System.out.println(i);
}
'cause here it is reading back the value from the array index, and I've found no value stored at index 2. So why the result was 0030?
Thanks in advance for help.