Java examples for Collection Framework:Vector
Get Size of Vector and loop through the elements
import java.util.Vector; public class Main { public static void main(String[] args) { Vector v = new Vector(); /*from w w w. j a va 2 s . co m*/ v.add("1"); v.add("2"); v.add("3"); //To get size of Java Vector use int size() method int totalElements = v.size(); System.out.println("Vector contains..."); for(int index=0; index < totalElements; index++) System.out.println(v.get(index)); } }