Object[] objs = new Object[5];
for (int i = 0; i < 5; ++i) {
int j = i + 1;
Object obj = objs[i];
}
I have two questions for the above loop:
- Are the
jvariable andobjreference created for every loop iteration or they are created once and then only reassigned the values? - Is there any perfomance benefit of putting
++iinstead ofi++as a single instruction to increment the value?
Declared and created every time
Not really.