This way, vector v has an internal array of size 10.But what is the incremental size of this Vector.
In vector capacity increment refers to the size by which the Vector increases it's storage capacity everytime it's filled up.
If you create a Vector in this fashion Vector v = new Vector(), the default size is 10 and capacity incerement is zero, ie
it will grow as needed only, ie when elements are added.
if I declare a Vector this way and later on during run time I have to add 15 elements to this vector, will this vector add those 15 elements or it will give me some exception?
Never ever will a Vector throw an exception complaining lack of space to store data. Thus the Vector will add 15 elements each and every time allocating space for each element that's being added. It does not reserve space as it would otherwise if you specify a capacity increment (using the Vector(int initialCapacity, int capacityIncrement) contructor).
What is the difference between declaring vector with :
Vector v = new Vector()
and
Vector v = new Vector(10)
Nothing. Both creates a Vector with initial capacity of ten and capacity increment zero (ie space is reserved on an 'as needed' basis)
Cheers,
Ram.