Skip to content

Instantly share code, notes, and snippets.

@draftcode
Last active February 27, 2016 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save draftcode/a3235b9469adc36a3e70 to your computer and use it in GitHub Desktop.
Save draftcode/a3235b9469adc36a3e70 to your computer and use it in GitHub Desktop.
class Test {
int var = 42;
void variableScope() {
switch (var) {
case 42:
int a = 1;
case 43:
// a is visible.
a = 2;
}
}
void classScope() {
switch (var) {
case 42:
class InnerClass {}
InnerClass obj1 = new InnerClass();
case 43:
// InnerClass is not visible.
InnerClass obj2 = new InnerClass();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment