Importing the Library Before you can use an ArrayList, you must first import the necessary library. Java Code: import java.util.ArrayList Creating a Generic ArrayList Generic ArrayList is an ArrayList with a type; no other type is allowed to be inserted into the ArrayList. Java Code: ArrayList<type> listName = new ArrayList<type>(); Example of this would be: Java Code: ArrayList<String> myArrayList = new ArrayList<String>(); ...
import java.util.ArrayList
ArrayList<type> listName = new ArrayList<type>();
ArrayList<String> myArrayList = new ArrayList<String>();
Updated 10-29-2012 at 08:29 PM by penguinCoder