Java Scrap Book  

Java Scrap Book > Java Collection > Overview of ArrayList

Overview of ArrayList

  • The ArrayList class extends AbstractList and implements the List interface.
  • The ArrayList class is the Collection Framework's replacement for the Vector class.
  • ArrayList is not synchronized by default,But Vector is synchronized.
  • add() member function used to add single element in ArrayList

package com.javascrapbook;
import java.util.ArrayList;;
import  java.util.List;
public class  ArrayListDemo {
   public static void main(String[] a) {
     List<Boolean>  list = new ArrayList<Boolean>();
     list.add(true);
     list.add(false);
     System.out.println(list.get(0));
     System.out.println(list.get(1));
       }
}


javascrapbook.com  © Copyright 2013
javascrapbook.com is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

Contact email: help@javascrapbook.com