• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting number format exception when trying to use parseInt  RSS feed

 
bob joe
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem occurs at the second to last line of text in this code. This is a homework assignment so can someone give me a hint as to what I'm doing wrong?


 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. What do you reckon the toString method returns for an array? What does it actually return?
 
Amir Al Take
Greenhorn
Posts: 15
Java Mac Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be very useful if you could provide the exact error message.
 
bob joe
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amir Al. wrote:It would be very useful if you could provide the exact error message.

Exception in thread "main" java.lang.NumberFormatException: For input string: "[C@29428e"

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bob joe wrote:
Amir Al. wrote:It would be very useful if you could provide the exact error message.

Exception in thread "main" java.lang.NumberFormatException: For input string: "[C@29428e"


As "[C@29428e" certainly isn't a valid number, the error is not surprising. You need to answer Ulf's question.
 
bob joe
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the hints. It works now. I did away with using toString. Honestly still not sure why it was returning garbage though, but I guess I'll look into it later.

 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bob joe wrote:Thanks for the hints. It works now. I did away with using toString. Honestly still not sure why it was returning garbage though, but I guess I'll look into it later.

I suggest you do, because it's quite important.

Hint: where does toString() originate?

Winston
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did away with using toString. Honestly still not sure why it was returning garbage though

Definitely not garbage, just something other than what you assumed it would return.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!