Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parseInt() help...

Status
Not open for further replies.

Savale

Technical User
Jun 14, 2001
17
0
0
US
So I'm bored at work, I've already looked through the api documentation on suns webpage, and I know this is a really stupid-simple question...

I'm just coding under the dos/edit function because that is all that is on the machine that I'm using. Obviously to declare a main there is a string array that is passed in off of the command line when you go to execute the program... what I have forgotten was how to change the string elements in the array to integers.

I've tried using the parseInt() method, but I keep getting and error saying "Cannot resolve symbol"

My code looks a little like this:

sum1 = parseInt(args[0]);
sum2 = parseInt(args[1]);

I'm sure its something totally stupid, but its been soooo long since I've done any java programming and I cant remember if... whatever... please help, thanks so much
 
Hi Savale
Your Code is giving error as you have not used Static method ie Integer.Your code should be

sum1=Integer.parseInt(args[0]);
sum2=Integer.parseInt(args[0]);
try this
dat
 
Hi Savale,

parseInt(...) is a static method in Integer -class, so you have to use Integer.parseInt(argv[0]);

-Vepo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top