I am trying to understand how this is valid in case statement of a switch in Java.
switch(someValue){
case abc: int i=0
break;
case def: int i=0 // error because i declared above is still accessible in this case.`
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.
Why does this not violate any fundamental concepts of programming?