Why does the following code give a compilation error?
if (true)
int p=10;
The following similar code works if I use block:
if (true) {
int p=10;
}
I am using Eclipse IDE. Please let me know the exact reason why we can't do the first one.