Java Program Array to Vector

package JavaPrograms;
import java.util.*;
public class ArraytoVector {

public static void main(String[] args) {
// declare and initialize array of object of given class.
Object[] arrObject = {"Manish", new Date(), "Rajesh"};
//create list for this object array.
List list = Arrays.asList(arrObject);
// create vector for given list.
Vector vector = new Vector(list);
// access the elements of the vector.
Enumeration enume = vector.elements();
while (enume.hasMoreElements()) {
System.out.println(enume.nextElement().toString());
}
}
}

 

You might also like More from author

Loading...