You'll note that the constructor Long(String) throws a NumberFormatException "if the String does not contain a parsable long." And in order to be a parsable long, "the characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ... to indicate a negative value."
Therefore, "1.0" is not a parsable long. If your String was simply "1" (without a decimal point), then it would work. [ September 14, 2004: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Dec 10, 2001
To put it another way, long is an integral data type. 1.0 is not an integer.
In Java, the literal numeric value 1.0 is a double, which is a floating point data type. Note that you could parse the String "1.0" into a double.