import java .util.*;
class vector
{
public static void main(String args[])
{
Vector vec=new Vector(5,2);
System.out.println("size:"+vec.size());
System.out.println("capacity:"+vec.capacity());
for(int i=1;i<6;i++)
vec.addElement(new Integer(i));
System.out.println("size:"+vec.size());
System.out.println("capacity:"+vec.capacity());
vec.addElement(new Double(173.58));
System.out.println("capacity:"+vec.capacity());
System.out.println("size:"+vec.size());
}
}
class vector
{
public static void main(String args[])
{
Vector vec=new Vector(5,2);
System.out.println("size:"+vec.size());
System.out.println("capacity:"+vec.capacity());
for(int i=1;i<6;i++)
vec.addElement(new Integer(i));
System.out.println("size:"+vec.size());
System.out.println("capacity:"+vec.capacity());
vec.addElement(new Double(173.58));
System.out.println("capacity:"+vec.capacity());
System.out.println("size:"+vec.size());
}
}
No comments:
Post a Comment