Executing a Block
A block is executed by executing its declarations and statements in sequence.
Executing a declaration creates a variable. When control leaves the block, the variable goes out of existence.
program text runtime storage
int a = readInt(); … a[_]
int b = readInt(); … a[_] b[_]
int temp = a; … a[_] b[_] temp[_]
a = b; … a[_] b[_] temp[_]
b = temp; … a[_] b[_] temp[_]
System.out.println(a); … a[_] b[_]
System.out.println(b); … a[_] b[_]