If I try to compile
for(;;)
{
}
System.out.println(\"End\");
The Java compiler produces an error saying Unreachable statement
From the JLS
An if-then statement can complete normally if at least one of the following is true:
> The if-then statement is reachable and the condition expression is not a constant expression whose value is true.
> The then-statement can complete normally.
So if(false) is allowed.
This ability to "conditionally compile" has a significant impact on, and relationship to, binary compatibility. If a set of classes that use such a "flag" variable are compiled and conditional code is omitted, it does not suffice later to distribute just a new version of the class or interface that contains the definition of the flag. A change to the value of a flag is, therefore, not binary compatible with pre-existing binaries . (There are other reasons for such incompatibility as well, such as the use of constants in case labels in switch statements;)