ArrayList

Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. This class is roughly equivalent to Vector, except that it is unsynchronized. this implementation is not synchronized

package collection.demos;


import java.util.ArrayList;

public class ArrayListDemo {

    public static void main(String[] args) {

        ArrayList<String> names=new ArrayList<String>();

        names.add("name1");

        names.add("name2");

        names.add("name3");

        names.add("name4");

        names.add("name5");

        System.out.println("Elements : "+names);


    }

}

No comments:

Popular Posts