In this Tutorial we want to describe you a code that help you in understanding a unreachable statement. For this we have a class name' unreachable error', Inside the main method we have a for loop that has a variable integer I.;. The System.out.println is used to display the value of variable integer i on command prompt. The continue statement in the code prevent from the normal execution of the code. The only difference between the continue and break statement is that break statement exits the control of the expression from the loop, but continue statement put the expression in the loop but without executing the code written after the continue statement. This code show you how the statement become unreachable after continue statement.
Compiling 1 source file to /home/girish/NetBeansProjects/errors/build/classes
unreachableerror.java:11: unreachable statement
BUILD FAILED (total time: 0 seconds)
Posted on: November 3, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles