title: local scope in Java
body: <p>Why is it that curly braces do not define a separate local scope in Java?  I was expecting this to be a feature common to the main curly brace languages (C, C++, Java, C#).</p>
  
  <pre><code>class LocalScopeTester
  {
      public static void main(String... args)
      {
          Dog mine = new Dog("fido");
          if (mine.getName().equals("ace"))
          {
              Dog mine = new Dog("spot"); // error: duplicate local
          }
          else
          {
              Dog mine = new Dog("barkley"); // error: duplicate local
              {
                  Dog mine = new Dog("boy"); // error: duplicate local
              }
          }
      }
  }
  </code></pre>