title: scope of a variable in java in switch
body: <p>I am trying to understand how this is valid in case statement of a switch in Java.</p>
  
  <pre><code>switch(someValue){
      case abc: int i=0
      break;
      case def: int i=0 // error because i declared above is still accessible in this case.`
  </code></pre>
  
  <p>If we say that variables have a block scope in Java , shouldn't the "i" variable be inaccessible in the case of def? Or is the case not treated as a block ?
  Many people must have come across this problem before.</p>
  
  <p>Why does this not violate any fundamental concepts of programming?</p>