sabaTEL.net

Java, MySQL, Avaya

Unreachable code

A typical question that we can expect at the exam is given a code that has no errors, try simulate the execution to find out what will be the score.

In those kind of questions, you don’t expect (at least I wasn’t expecting) the compiler to complain about a condition that can never be satisfied in order to execute certain code.

In this example, the fact that we are throwing an exception at the try block means that line 10 will never be executed. The Exception will be catch but we will never return to finish the rest of the try block.

Advertisements

May 24, 2013 Posted by | Java | Leave a comment