title: Unreachable statement compile error in Java
body: <pre><code>class For1
  {
    public static void main(String args[])
    {
      int a = 0;
      for(;;)
      {
        break;
        System.out.println(a); //Line 1
        ++a;//Line 2
      }
    }
  }
  </code></pre>
  
  <p>I know that Line 1/Line 2 will never be executed.
  But still I don't understand why a compile time error is thrown.
  I am getting "unreachable statement" compile error.</p>
  
  <p>Does it mean that compiler checks whether it is able to compile for all branches/lines of code ?</p>