public class MainClass {
public static void main(String[] args) {
int outer = 1;
{
int inner = 2;
System.out.println("inner = " + inner);
System.out.println("outer = " + outer);
}
int inner = 3;
System.out.println("inner = " + inner);
System.out.println("outer = " + outer);
}
}
inner = 2
outer = 1
inner = 3
outer = 1
1.10.Variable Scope |
| 1.10.1. | Variable Scope |
| 1.10.2. | Variable Scope in a block |