• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

I want to get an int from the String[] args from main

Is it possible to make it an int[] args or something?  Or do I have to convert the string to and int?  If so, what is the best way to do that?

Thanks,
Jonathan.
0
twibblej
Asked:
twibblej
  • 2
1 Solution
 
objectsCommented:
u need to convert them:

int[] iargs= new int[args.length];
for (int i=0; i<args.length; i++)
{
   iargs[i] = Integer.parseInt(args[i]);
}
0
 
petmagdyCommented:

int val= Integer.parseInt(args[i]);
0
 
objectsCommented:
???
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now