Compiler Error J0104

Unreachable statement or declaration

The compiler detected a statement or declaration that cannot be reached under any circumstances. This error usually occurs when a return statement is called from a method, and code is placed below the return statement. This error can also occur if a break statement is used in a loop without any flow control to allow code below it to be run.

The following example illustrates this error:

class Simple {
   public int method1(int arg1){
      for (int y = 10; y < 10;y++){
         break;
         int z = y +10; //error: break causes this line to never be run
      }
      //do something here
      return arg1;
      int x = arg1 /2;
      /*error: this line of code cannot be reached because of return
               statement */
   }
}