In a java loop like this:
for (File f : files) {
String s = f.getName();
}
Is it possible to make any claim about the relative locations in memory that will be allotted for String s
in each iteration of the loop?
Does the compiler know that we will be allocating space for a String s
repeatedly? If yes, does it allocate some fixed space for it or make other relevant optimisations with this knowledge?