Khurram Fakhar
Ranch Hand
Posts: 65
HI guyz ,
What is the size of a vector ?
we can access its elements by passing an integer as an argument so ,
is size of the vector equal to maximum integer value ?
just write whatever is in all of ur minds
regards
Khurram Fakhar

Ranch Hand
Posts: 5040

Pl. refer to the Java API specs for the Vector class.
Hope this answers most of the qstns. I hate to miss something
which you need to know.
Regds.
- satya

Pratap Reddy
Ranch Hand
Posts: 36
Vector defines two methods size() and capacity(). Size give number of you already stored and capacity() gives maximum number of objects can be stored.

Khurram Fakhar
Ranch Hand
Posts: 65
Hi ppl,
Well mr. Satya , i have already read the documentation but there is no material regarding my question.
My question was, what is the maximum size of a vector.
We ppl access elements of vectors by passing an integer value.
An integer has some specific limit to store some value.
So what if , elements in vector exceeds more than that limit of integer value ?
how can we access those elements which cant be accessed by passing integer argument ?
Correct me if i m wrong .

Regards
Khurram Fakhar

Ranch Hand
Posts: 5040
So what if , elements in vector exceeds more than that limit of integer value ?
how can we access those elements which cant be accessed by passing integer argument

Forgive me, my imagination is limited
But, don't you think that an Exception of some kind will be
thrown when vector exceeds more than that limit of integer value.
I would guess thats what will happen.
Hope I got you right this time.
Regds.
- satya

Khurram Fakhar
Ranch Hand
Posts: 65
Thanx Mr. Satya for ur help

Regards
Khurram

Panagiotis Varlagas
Ranch Hand
Posts: 233
A Vector is backed by an array. Since the dimension of an array is of type int, the capacity of a Vector (and thus its size too, since size <= capacity) is be at most Integer.MAX_VALUE.

If a Vector v already has the maximum size, then attempting to