Thursday, January 19, 2012

LinkedList & ArrayList

package Classes.main;
import java.util.ArrayList;
import java.util.Iterator;

public class ArrayListClass {

public static void main(String[] args) {

ArrayListClass arrayListClass = new ArrayListClass();
int a=11, b=22, c=33;
int size;
String temp;
Iterator iterator ;
ArrayList al=new ArrayList ();

al.add(a);
al.add(b);
al.add(c);
iterator=al.iterator();
// Create Iterator
size=al.size();
System.out.println("Size of ArrayList is :: "+size);

while(iterator.hasNext()){
System.out.println(iterator.next());
}

int neel[]=new int[10];
int j=0;
for(int i=0;ineel[j]=al.get(i);
j++;
}

System.out.println("Printing Array Value");
for(int k=0;kSystem.out.println(neel[k]);
}
}
}