I know it sounds stupid but I want to try this with the kind of for (not the norma for i=0 i<9; i++) but the other one with arraylist. is this possible? If yes please help me match data types

Thanks

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: stefano
 * Date: Jun 29, 2010
 * Time: 6:27:19 PM
 * To change this template use File | Settings | File Templates.
 */
public class TestClass {

    public static void main(String [] args){
        List lst = new ArrayList();
        lst.add("A");
        lst.add("B");
        lst.add("C");
        lst.add("D");

        for(String st: lst){
            System.out.println(st);
        }
    }
}

Oops, I got it

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: stefano
 * Date: Jun 29, 2010
 * Time: 6:27:19 PM
 * To change this template use File | Settings | File Templates.
 */
public class TestClass {

    public static void main(String [] args){
        List<String> lst = new ArrayList<String>();
        lst.add("A");
        lst.add("B");
        lst.add("C");
        lst.add("D");

        for(String st: lst){
            System.out.println(st);
        }
    }
}
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.