I know this sounds trivial, but I just want to clear my head of it.
consider
for (int i = 0; i < 100; i++) {
int x=i;
System.println(i);
}
represents a new created and allocated memory for each iteration, or the compiler with confidence displays the script and creates it only once and changes its value (since it knows that it is a loop),
and as for the declaration iinside the method signature, is it obviously instantiated immediately once?
will also be
int x = 0;
for (int i = 0; i < 100; i++) {
x = i;
System.println(i);
}
really more effective the higher?
in java in cases where I do not need to access xoutside the loop, is it better to declare it inside, which is good practice?