I know that the foreach loop used in the following example doesn't compile. But does anybody know why using a field in a foreach loop declaration isn't allowed?
public class Foo {
private Object obj;
public void run(List<Object> objects) {
for (obj : objects) {
process();
}
}
private void process() {
// do something with obj
}
}