JDK 5.0 provides typed array list. Before JDK 5.0 Array List store the objects of type Object. But now type of the elements of an ArrayList can be specified.

Syntax:

ArrayList list = new ArrayList();

Example:

 import java.util.ArrayList;

public class MyArrayList {

  public static void main(String[] args) {
  
    Seller sel = new Seller();
    Buyer buy = new Buyer();
  
    // declare an array list of type Seller
    ArrayList<Seller> list = new ArrayList<Seller>();
    list.add(sel); // add object of type Seller which is permisible
    list.add(buy);  // this statement will give an error
   }
}