what is the difference between ArrayList and Vector
Answer Posted / vikas
1. Vector is synchronized while ArrayList is not.
2. Vector has default size is 10 while ArrayList has 10(Look
Java Class).
3. We can specify increment size with Vector.
4. If we use ensureCapacity(int minCapacity) to set the
default increment size then remember following things:
a. Vector v = new Vector();
b. V.capacity(); === output will be 10
c. If you try to set v.ensureCapacity(5),then
d. V.capacity(); ===10
e. If you try to set v.ensureCapacity( >20), then
f. V.capacity();===20 and
g. If you try to set v.ensureCapacity(21), then
h. V.capacity();===21, It clears that if set capacity over
20 then it will be set otherwise no.
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
What is the replace tool?
Can we overload the methods by making them static?
os is developed in c no java is more secured then c na why dont the os developed is developed using java
What are the different approaches to implement a function to generate a random number?
What is oops in java?
What does n mean in java?
What is difference between next () and nextline () in java?
what is aggregation in java?
What is java util list?
What is lazy programming?
What are the 5 types of research methods?
What is extension method in java?
Can we override private method?
Why java is said to be pass-by-value ?
Which keyword specify that a variable is effectively final ?