scope - Java - If I return in a catch block, will the finally block be executed? -


this question has answer here:

this i'm trying do:

try {      //code } catch (exception e) {      return false; } {      //close resources } 

will work? bad practice? better doing this:

boolean inserted = true;  try {      //code } catch (exception e) {      inserted = false; } {      //close resources }  return inserted; 

yes, will. things can prevent block execute (afair) system.exit(), , infinite loop (and jvm crash, of course).


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -