Well, this is about brackets (i.e. areas).
It is better to practice, perhaps write your statements like this:
int i = 2; switch(i) { case 1: { String myString = "foo"; break; } case 2: { myString = "poo"; System.out.println(myString); } }
(I'm not right next to the Java compiler, but this should not compile).
Noon silk
source share