Saturday, May 6, 2017

Array List in Java

Here is a simple implementation of array list data structure in Java. The code is very short and easy to understand.  Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

package list;

import java.util.*;

class array_list{

public static void main(String args[]){
 
 ArrayList<String> users= new ArrayList<String>();
 
 users.add("Jacob");
 users.add("Ana");
 users.add("Mark");
 users.add("Ma.Junallie");
 users.add("Julianna Rae");
 users.add("Paul Jun");
 users.add("Joan");
 users.add("Sally");
 Iterator <String> list_all =users.iterator();
 
 System.out.println();
 System.out.println("List of Users");
 System.out.println();
 
 while(list_all.hasNext()){
  System.out.println(list_all.next());
 }
}
}


No comments:

Post a Comment