Java return to position N in call stack.
Posted
by Finbarr
on Stack Overflow
See other posts from Stack Overflow
or by Finbarr
Published on 2010-05-04T22:10:57Z
Indexed on
2010/05/04
22:28 UTC
Read the original article
Hit count: 237
Using the return
keyword in Java code will return execution to the last piece of calling code in the call stack. If object foo
calls baz.bar()
, the return
keyword in the bar
method will continue code execution in foo
.
Let's say I have object foo
that calls foofoo
that calls foofoofoo
in the above scenario, and foofoofoo
calls baz.bar()
. Is there anyway in Java to use the return
keyword, or something else, so that the code in the bar
method can return all the way back up to foo
?
(WITHOUT THROWING AN EXCEPTION)
© Stack Overflow or respective owner