Help the world stop coronavirus! Stay home!

Prev Next

Java / Control Statements

Difference between dead code and unreachable code in Java.

Dead code is a compiler warning while unreachable code is a compile time error.

As per Java language specification, there must be some possible execution path from the beginning of the constructor, method, instance initializer or static initializer that contains the statement to the statement itself. The analysis takes into account the structure of statements. Except for the special treatment of while, do, and for statements whose condition expression has the constant value true, the values of expressions are not taken into account in the flow analysis.

As per the JLS, if statement is excluded so we get dead code warning.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Access Modifiers

Comments & Discussions