[Posted before seeing Roel's reply; consider this a separate response to Murat - Mike]
The notion of what is "reachable" can be somewhat counterintuitive. The compiler is required to follow certain rules about what it considered reachable, and what isn't. These rules don't always match up with what is
really reachable, or not. But the compiler is required to follow them consistently, because Sun and Oracle don't want code to compile successfully on some compilers but not others.
In your original class A, the println is considered reachable because of the catch NumberFormatException, which, if an exception were caught there, would cause program execution to proceed on to the println statement. In reality, there's no way that the code shown would ever throw a NumberFormatException, so this isn't
really reachable. However the compiler is required to assume that an unchecked exception could possibly be thrown from any code, anywhere, with no warning. Since NumberFormatException is unchecked, the catch clause is considered reachable, even if there's no way it could really happen.
In the case of if (true) example given by Roel, there's another special rule on reachability, found in the
Java Language Specification, with an explanation. Can you find the relevant rule?