Why does a Java Compiler not produce an unreachable statement error for an unreachable then statement?

The behaviour is defined in the JLS description of unreachable statements: The then-statement is reachable iff the if-then statement is reachable. So the compiler determines that the then-statement (break;) is reachable, regardless of the condition in the if. And a bit further, emphasis mine: A basic for statement can complete normally iff at least one … Read more

Why does Java have an “unreachable statement” compiler error?

Because unreachable code is meaningless to the compiler. Whilst making code meaningful to people is both paramount and harder than making it meaningful to a compiler, the compiler is the essential consumer of code. The designers of Java take the viewpoint that code that is not meaningful to the compiler is an error. Their stance … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)