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


Please Help Members By Posting Answers For Below Questions

What is meant by distributed application? Why are we using that in our application?

754


What is the char data type?

772


Why is a singleton bad?

753


What is the full meaning of java?

776


What are the two parts of a conditional statement?

726


Can we serialize singleton class?

770


4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (

1634


Difference between concurrent hashmap and hashtable and collections

797


Print Vertical traversal of a Binary Tree.

800


What is bool mean?

752


Is double bigger than float?

746


Difference between static synchronization vs. Instance synchronization?

821


What is the implementation of destroy method in java. Is it native or java code?

727


If I only change the return type, does the method become overloaded?

728


Describe method overriding

807