One example of code that causes this:
int a=0; int b=0; If (a==5 && b==6) Note capital I on the if System.out.println("Foo!");
As there isn't a command called If, only if, Java doesn't recognize it. A similar error will occur if you put any command that doesn't exist there. If you're sure the command exists, check your spelling and caps.