Displaying arrays

I've tried to do some searching, but I just got more confused on the subject. Essentially here's the deal: I am having users input two string variables into a single array list for a time zone. I would like to display each variable separately but am unsure how to do it - I do not want to display the entire array as one. My code is below:

So, in case that doesn't exactly make sense, I basically want it to be like follows...

Run the program, user inputs a zoneInfo of "Chicago" (for that time zone) and timeInfo as "+6". they can then put in another of "Paris" and "-1". I would like to display the result as

"Chicago; GMT +/- 6 Paris; GMT +/- 1"

Instead of how it currently displays, as

"[Chicago6,Paris-1]"

But I keep on getting an error saying that Zonestuhs.zoneInfo is invalid - says that zoneInfo variable cannot be found.

Any insight would be greatly helpful, even if it's just pointing me to a helpful tutorial I can read over. Thanks for the help!

Well, it's an array list. If you want the individual methods of the list, then you have to get() them (in a loop), or iterate through them (also in a loop). If you just print it, it will just call the toString() method, which gives you the whole list.

But I keep on getting an error saying that Zonestuhs.zoneInfo is invalid - says that zoneInfo variable cannot be found.

That is because there is no such variable in the array list. The array list is holding elements. In this case, strings elements, which you have to use the get() method to retrieve. Furthermore, you actually concatenated two of your variables, for the element. This is not recommended, because if you want them back you'll have to parse it back.

Beautiful. Thanks a bunch for the help, that at least gives me a solid starting point for where to look.

Another quick question, that I'm having trouble searching for on Google because of its long wording....

Basically I want to make it so that if a user enters information that already exists in Zonestuhs (ie if a user enters a zoneInfo name twice, or the timeInfo variable two different times) I want it to reject the addition and display some sort of error message. I think I should be able to write it into an if/else statement, since I'm using that effectively to make sure that the timeInfo is between -12 and +12, and that is working fine. Because of how I have it set up, will I find some issues with getting this to work properly? If not, any pointers?

Because of how I have it set up, will I find some issues with getting this to work properly? If not, any pointers?

As already mentioned, because you stored the two values as a concatenated string, you will have to parse it back to use it. I would recommend that you create a new type with your two values, and create an array list of that type -- no parsing necessary.