java.util.Vector.copyInto() 方法 java.util.Vector.containsAll() 方法 java.util.Vector.elementAt() 方法 java.util.Vector.copyInto() 方法 package com.codingdict; import java.util.Vector; public class VectorDemo { public static void main(String[] args) { // create an empty Vector vec with an initial capacity of 4 Vector<Integer> vec = new Vector<Integer>(4); Integer anArray[] = new Integer[4]; anArray[0] = 100; anArray[1] = 100; anArray[2] = 100; anArray[3] = 100; // use add() method to add elements in the vector vec.add(4); vec.add(3); vec.add(2); vec.add(1); // numbers in the array before copy System.out.println("Numbers in the array before copy"); for (Integer number : anArray) { System.out.println("Number = " + number); } // copy into the array vec.copyInto(anArray); // numbers in the array after copy System.out.println("Numbers in the array after copy"); for (Integer number : anArray) { System.out.println("Number = " + number); } } } java.util.Vector.containsAll() 方法 java.util.Vector.elementAt() 方法