Two Laptop Bag
The moose likes Beginning Java and the fly likes Methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Methods" Watch "Methods" New topic



Joined: Oct 28, 2003
Posts: 2
Could somebody please show me the code for writing a method that accept 1 argument - array of strings, and also converts the values in the array of strings into integers.
Thank you.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
For an example of a method that takes an array of strings, look no futher than

To convert the strings to integers, you will need to iterate through the array with a for loop. Inside the loop, you can use some of the methods in the Integer class to convert the string into and integer value.
Give this a try. If you still run into problems, post your code and we'll give you some additional pointers. This looks like a homework problem. Most of the ranch hands here will be happy to give advice, but we won't provide a complete solution for you.
Good luck!

Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
I agree. Here's the link:
subject: Methods
It's not a secret anymore!