import java.util.*; public class array_to_vector { public static void main(String[] args) { String[] arr = { "hi","hello","welcome","pvpsit" }; // method-1 create a new vector object of the same type Vector v = new Vector(); // Use the addAll method of the Collections to add // all array elements to the vector object Collections.addAll(v, arr); // method-2 create a new vector object of the same type Vector v = new Vector(Arrays.asList(arr)); // method-3 create a new vector object of the same type Vector v = new Vector(); for (int i = 0; i < arr.length; i++) v.addElement(arr[i]); // printing vector System.out.println(v); } }