Results 1 to 4 of 4
Thread: Integer.parseInt("5.843"); Error
- 04-15-2010, 01:36 PM #1
Integer.parseInt("5.843"); Error
My error:
Why does it not want to parse my String "5.843" to int?java.lang.NumberFormatException: For input string: "5.843"
at java.lang.NumberFormatException.forInputString(Unk nown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at test.main(test.java:50)
The code I use for the parsing is
I've also tried replacing the code which gets the String with the value from the xml file with just the string "5.843" and it still gives the same error.Java Code:valuta[s] = Integer.parseInt(((Node) lstNm.item(0)).getNodeValue());
I've googled the error but I can't seem to find an answer.
Thank you.Carpe Diem
Each day's a gift and not a given right
- 04-15-2010, 01:55 PM #2
- 04-15-2010, 01:57 PM #3
Of course! Feel really dumb now, was kinda obvious :(
Thank you! :DCarpe Diem
Each day's a gift and not a given right
- 04-15-2010, 05:16 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
NumberFormatException, always explain about that. As it named, once you comes-up with such an error check the format at RUNTIME. Keep in mind, this error cannot detect at the compile time, only at RUNTIME
Can you please mark the thread solved if you satisfied with the answer.
Similar Threads
-
How to change my form design from "metal" to "nimbus" in Netbeans 6.7.1?
By mlibot in forum New To JavaReplies: 1Last Post: 01-21-2010, 09:20 AM -
Runtime error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
By shantimudigonda in forum New To JavaReplies: 1Last Post: 11-20-2009, 07:58 PM -
"parse error at or before "}""
By constden in forum New To JavaReplies: 32Last Post: 04-25-2009, 09:49 PM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks