I've made 2 pieces of code. The first works fine, but the other says the variable declaration not allowed here.
First code(Working)
class Test {
public static void main(String args[]){
for(int i=0;i<10;i++) {
int a[]=new int[10];
}
}
}
Second code(Not working)
class Test {
public static void main(String args[]) {
for(int i=0;i<10;i++)
int a[]=new int[10];
}
}
What is the reason behind it; I think both sections of code are nearly the same.