The main problem in the
parseFloat method is the
finally block: it has a
return statement so it doesn't end normally. Having a
return statement in the
finally block is allowed by the JLS but it's considered to be a (very) bad practice. Because strange things will happen (as you noticed). If there is a
return statement within the
finally block, it will trump any other return from the regular block. That is, the following code will print
false
And the same thing happens with an uncaught exception: because of the
return statement, the uncaught exception is discarded and forgotten.
Here you'll find the appropriate section of the JLS describing this behavior (it's even in bold

).
Hope it helps!
Kind regards,
Roel
PS. I really like your question and the effort you made to create a quality post: a nice code snippet (correct indentation, nothing more but appropriate code,...), a few different scenarios which you used to test your knowledge and a great question. Have a
cow!