Hi, I am new to Java and am doing this as an on the side project.

I have an ArrayList of Strings. I want access each individual String and then do something with that string recursively.

However I used the Tokenizer to get the Strings and put them into arrays, so everything is under static void main method and I cannot implement another method unless its outwith the static void main method..

I need help taking each String from the List and comparing each character in the String inside my static void main method.

*Code is at home(at work) will post later if needed*

Thanks.

I'm not really sure what you are trying to do, but one thing that might help you is a for-each loop. The syntax is as follows:

for (One instance of a type : A collection of that type)
{
    //Iterate through the list.
}

For example,

ArrayList<String> arr = new ArrayList<String>();
//pretend arr is initialized to contain a bunch of strings.

for (String s : arr)
{
    /* This code will be executed for every string contained in list arr,
     * and when arr contains no more strings
     * the for-each loop will automatically break.
     */
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.