How to Convert Array to Vector

import java.util.Arrays;
import java.util.Vector;

public class ArrayToVector {

public static void main(String[] args) {
String [] arr ={“java”,”c”,”cpp”,”php”,”html”};

Vector<String> vector = new Vector<String>(Arrays.asList(arr));

for (String str : vector) {

System.out.println(“Element is = “+str);

}

}

}

Output:

Element is = java

Element is = c

Element is = cpp

Element is = php

Element is = html

Leave a Reply

Your email address will not be published. Required fields are marked *

96 − 89 =