Last active
February 27, 2016 22:12
-
-
Save draftcode/a3235b9469adc36a3e70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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