Explain what will the code return

Technology CommunityCategory: JavaExplain what will the code return
VietMX Staff asked 3 years ago
Problem

Consider:

try { return true; } finally { return false; }

If there is a return statement within the finally block, it will trump any other return from the regular block. That is, the following block would return false. And a return within finally ignores any exception thrown in try. Scary!