Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Conversion of Object to int  RSS feed

 
angelin prema
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am getting NumberFormatException while converting Object to int.
I ve tried with this,
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you need to find out what "o.toString()" looks like. The exception is telling you that it doesn't look like an integer -- i.e., it has other characters in it besides digits or a leading minus sign.
 
angelin prema
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to rectify the problem
Can you send me the code?
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by angelin prema:
how to rectify the problem
Can you send me the code?


There is no need to send the code. You may need to send you expectations about "Iterator i =list.iterator();"
What you are expecting to be come out from this iterator.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stick in a "System.out.println(o.toString())" before any of the parseInt() calls, and see what it prints.
 
angelin prema
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved the problem
Anyway thanks for you help
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!