CreateVector.java Source code

Java tutorial

Introduction

Here is the source code for CreateVector.java

Source

import java.util.Vector;

public class CreateVector {
    public static void main(String args[]) {
        {
            Vector v = new Vector(0);
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
        }
        {
            Vector v = new Vector();
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
            v.addElement("Hello");
            System.out.println(v.capacity());
        }
    }
}