Home Tutorial Java Collections Arraylist Java ArrayList, Java Array List examples

 
 

Share on Google+Share on Google+
Java ArrayList, Java Array List examples
Posted on: October 22, 2009 at 12:00 AM
Advertisement
Learn Java Array List with example code

The Java ArrayList (java.util.ArrayList) is resizable implementation of the List interface. It has support for all the functions present in the List interface and it permits all the elements. The ArrayList also permits the null. Learn the ArrayList in Java with the example code.

SampleInterfaceImp.java

import java.util.ArrayList;
import java.util.Iterator;

public class ArrayListExample {
	public static void main(String[] args) {

		// Making ArrayList Object
		ArrayList list = new ArrayList();

		// Adding Element to the ArrayList Object
		list.add("Java ");
		list.add("is ");
		list.add("very ");
		list.add("good ");
		list.add("programming ");
		list.add("language ");

		// Displaying the Object from the ArrayList
		Iterator listIterator = list.iterator();

		while (listIterator.hasNext()) {
			System.out.print(listIterator.next());
		}
	}
}


When you run this application it will display message as shown below:


Java is very good programming language

Download Select Source Code

Advertisement

Related Tags for Java ArrayList, Java Array List examples:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 22, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com