Are subcontexts in Java separate rows on the stack?
Posted
by Bart van Heukelom
on Stack Overflow
See other posts from Stack Overflow
or by Bart van Heukelom
Published on 2010-06-17T11:24:01Z
Indexed on
2010/06/17
11:33 UTC
Read the original article
Hit count: 436
In Java this is the case:
public void method() {
if (condition) {
Object x = ....;
}
System.out.println(x); // Error: x unavailable
}
What I'm wondering is this: Is the fact that x
is limited to the scope of the if
-statement just a feature of the Java compiler, or is x
actually removed from the stack after the if
-statement?
© Stack Overflow or respective owner