Because you have a carrage return after the if(j%2==0) instead of the
following line.
these are good examples of if statements:
if (something) doStuff();
if (something){
doStuff();
} else {
doOtherStuff();
}
These are dangerous examples:
if (something)
doStuff;
if (something) doStuff;
else doOtherStuff();
Now why are the second lot more dangerous the the first lot?
Well basicly they have less chance to be magicaly broken during the
coding process. If we changed ...
if (something)
doStuff;
to
if (something)
doStuff();
it won't work because of the extra carrage return.
Errors like that are realy hard to find in large code ... or even small
code when youa re first starting.
As messy as it looks at first I would always recommend new coders to
always put blocks around a if statement ... even if it is only one thing
they are putting in the if statement.
i.e.
if (something) {
doStuff();
}
This leads to good coding practices and it leads to less mistakes.