I know in c++ variables have block scope, for example, the following code works in C++
void foo(){
int a = 0;
for(int i = 0; i < 10; ++i){
int a = 1; //re-define a here.
}
}
but this snippet doesnt work in java, it reports "duplicate local variable a", does it mean java variables dont have BLOCK scope?