Top.Mail.Ru
December 27th, 2006 - Java developers — LiveJournal
? ?

Java developers

December 27th, 2006
Image

03:54 pm - Imagebanana - Number parsing exception asymmetry

Suppose that you want to make number primitives from strings. You could do Integer.parseInt ( someString ) - easy. But sometimes the parameter might be null. What happens than? An exception, and from experience I know that it's NumberFormatException.

What if you want a double rather than an int? Double.parseDouble ( someString ) is good, but can you guess what it does with null? Here's a test class and its output.
Read more...Collapse )

Anyone know a good reason for this?
Powered by LiveJournal.com
Image