Home Tutorial Java Collections Arraylist Java arraylist of objects


Share on Google+Share on Google+
Java arraylist of objects
Posted on: October 23, 2009 at 12:00 AM
This Java tutorial section, we demonstrates how to use objects in the Java ArrayList.

  • In arrayList object is added by default
  • This can be object of String, Integer or any Wrapper class

Example of Java Arraylist of Objects
import java.util.ArrayList;
import java.util.List;

public class List1 {
    public static void main(String[] args) {
       String name1=new String("mac");
       String name2=new String("jack");
       String name3=new String("john");
       String name4=new String("rob");

       List list=new ArrayList(4);
         for(int x=0;x


Related Tags for Java arraylist of objects:

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 23, 2009

Recommend the tutorial

Advertisements Advertisements