title: using labels in java without "loops"
body: <p>I always thought that the labels must be used only with loops but it seems not. Giving such code:</p>
  
  <pre><code>public class LabelTest {
      public static void main(String[] args) {
          label1: System.out.println("");
          label2: LabelTest t = new LabelTest();  
      }                                               
  }
  </code></pre>
  
  <p>When compiled line labeled "label1" compiles but the code at "label2" gives errors. Why's that? And why would I want to label statements which are not "loops"?</p>