This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fetch in integer variable

 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to fetch following string array into integer array


i am doing like following


but it is giving compile time error.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this:
 
Matthew Brown
Bartender
Posts: 4565
8
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Integer.parseInt takes a String as the argument, but you're passing it a String array.

To convert an array of Strings into an array of ints, you need to create the int array of the right size, then loop round the arrays converting each individual String to an int.
 
Athira Vineeth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try this


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic