title: Behavior of switch statement with the default block at the top
body: <p>I found one interesting way to use a <code>switch</code> statement in Java, and I can't catch all logic.</p>
  
  <p>Can someone help to understand all details in depth?</p>
  
  <p>Here is code:</p>
  
  <pre><code>private static int counter = 0;
  
  public static Shape randomFactory() {
  
      int xVal = rand.nextInt(100);
      int yVal = rand.nextInt(100);
      int dim = rand.nextInt(100);
  
      switch (counter++ % 3) {
      default:
      case 0:
          return new Circle(xVal, yVal, dim);
      case 1:
          return new Square(xVal, yVal, dim);
      case 2:
          return new Line(xVal, yVal, dim);
      }
  }
  </code></pre>
  
  <p>In general I understand this logic,</p>
  
  <p>What exactly <code>default</code> mean here:</p>
  
  <pre><code>switch (counter++ % 3) {
          default:
  </code></pre>
  
  <p>And how does <code>switch (counter++ % 3)</code> find equals case? And here isn't any <code>brake</code> presented.</p>
  
  <p>Any suggestions?</p>