title: error:undefined label, how to use label statement in this code in java?
body: <p>I read in textbooks for Java that any statement can be labeled and can be used with break.
  But while trying this code i get error undefined label. (Guys at stackoverflow wait before marking this question as duplicate, i have checked those questions but none of those explain this problem).</p>
  
  <pre><code>public class LabelTest {
  
      public static void main(String[] args) {
  
          first: System.out.println("First statement");
          for (int i = 0; i &lt; 2; i++) {
              System.out.println("Second statement");
              break first;
          }
      }
  }
  </code></pre>