Edit: I asked this question during my first course after starting a degree in Software Engineering. I realize now that it's pretty silly but I really appreciate anyone who took the time to answer.
I'm having trouble tracing some code to get the output:
int[] a = new int[5];
for (int i = 0; i < a.length; i++)
{
a[i] = i*3-1;
}
for (int i = a.length-1; i >= 0; i--)
{
System.out.print(a[i] + " " );
}
This outputs:
11 8 5 2 -1
What I don't understand is why the second variable 'i' is being put back in the formula from the first For Loop. Can someone help me connect these two loops? The array is defined in the first loop, so why does it affect the second? I don't understand the relation, perhaps I'm just missing it.