Possible Duplicate:
Why this is not compiling in Java?
In java, curly braces are optional for one line for loops, but I've found a case where it isn't allowed. For instance, this code:
for(int i = 0; i < 10; i++)
Integer a = i;
won't compile, but if you add curly braces, like so:
for(int i = 0; i < 10; i++){
Integer a = i;
}
it will. Why won't this code compile?