java.util.Vector.equals() 方法 java.util.Vector.ensureCapacity() 方法 java.util.Vector.firstElement() 方法 java.util.Vector.equals() 方法 package com.codingdict; import java.util.Vector; public class VectorDemo { public static void main(String[] args) { // create two empty Vectors an initial capacity of 4 Vector<Integer> firstvec = new Vector<Integer>(4); Vector<Integer> secondvec = new Vector<Integer>(4); // additing in firstvec firstvec.add(4); firstvec.add(3); firstvec.add(2); // additing in secondvec secondvec.add(4); secondvec.add(3); secondvec.add(2); // let us print all the elements available in vector System.out.println("Testing equality of firstvec and secondvec :"+ firstvec.equals(secondvec)); } } java.util.Vector.ensureCapacity() 方法 java.util.Vector.firstElement() 方法