I'm studying for the OCA exam and I do not understand why the last line in parseFloat() is unreachable, while the last line in go() is not. Except for the return types, I do not see much of a difference.
public float parseFloat(String s) {
float f = 0.0F;
try {
f = Float.valueOf(s).floatValue();
return f;
} catch (NumberFormatException e) {
f = Float.NaN;
return f;
} finally {
return f;
}
System.out.println(""); //unreachable statement
}
public void go() {
System.out.println("A");
try {
System.out.println(3 / 0);
} catch (ArithmeticException e) {
System.out.println("b");
} finally {
System.out.println("c");
}
System.out.println("d"); //reachable statement
}