Java Program Array to Vector

56
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());
}
}
}

 

Subscribe to Newsletter
Get Latest Posts, Articles and Learning Lessons on Software Testing and Test Automation
You can unsubscribe at any time

Comments are closed.