java - What is the cost of try catch blocks? -
how better is:
if (condition) { try { //something } catch(someex ex) {} }
instead of this:
try { if (condition) { //something } } catch(someex ex) {}
what jvm when enter try block ?
edit: don't want know in second example go in try... please answer question.
execution wise @ run time, long there no exception, try not cost anything. costs run time exception occurs. , in situation slower if evaluation.
in jvm spec, see there no byte code generated on execution path: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-3.html#jvms-3.12
Comments
Post a Comment