[an error occurred while processing this directive]

Java error unreachable statement


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.





import java.util.*;

public class unreachableerror {

    public static void main(String arg[]) {
        for (int i = 0; i <= 5; i++)


On the execution of a program, the output on the command prompt is  displayed as

Compiling source file to /home/girish/NetBeansProjects/errors/build/classes
11: unreachable statement
BUILD FAILED (total time: seconds)

To resolve this error remove continue; from this program

Download code


[an error occurred while processing this directive]