// Program
import
java.util.*;
public
class Vectors
{
public static void main(String args[])
{
Vector <String>obj = new
Vector<String>(5);
obj.addElement("A");
obj.addElement("M");
obj.addElement("P");
obj.addElement("L");
obj.addElement("K");
System.out.println("Size of Vector
is: "+obj.size());
System.out.println("Capacity is :
"+obj.capacity());
System.out.println("Vector Elements
are :"+obj);
obj.addElement("S");
obj.addElement("H");
System.out.println("Size of Vector
is: "+obj.size());
System.out.println("Capacity is :
"+obj.capacity());
System.out.println("Vector Elements
are :"+obj);
obj.addElement("W");
obj.addElement("B");
obj.addElement("C");
obj.addElement("X");
System.out.println("Size of Vector
is: "+obj.size());
System.out.println("Capacity is :
"+obj.capacity());
System.out.println("Vector Elements
are :"+obj);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.