Pages

Wednesday, December 23, 2009

VectorDemo

import java.util.*;

public class VectorDemo {

public VectorDemo()
{

Vector v = new Vector();
v.add("10");
v.add("20");
v.add("30");
v.add("20");
v.add("10");
System.out.println(v);
Collections.sort(v);
System.out.println(v);

Enumeration e = v.elements();
while(e.hasMoreElements())
{
System.out.print(e.nextElement()+" ");
}
Collections.synchronizedList(v);
System.out.println(v);


}

/**
* @param args
*/
public static void main(String[] args) {
new VectorDemo();

}

}

No comments:

Post a Comment