Multiple returns: Which one sets the final return value?
Posted
by DR
on Stack Overflow
See other posts from Stack Overflow
or by DR
Published on 2010-02-22T09:35:51Z
Indexed on
2010/04/22
12:53 UTC
Read the original article
Hit count: 206
Given this code:
String test() {
try {
return "1";
} finally {
return "2";
}
}
Do the language specifications define the return value of a call to test()
? In other words: Is it always the same in every JVM?
In the Sun JVM the return value is 2
, but I want to be sure, that this is not VM-dependant.
© Stack Overflow or respective owner