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 meant by distributed application? Why are we using that in our application?
What is the char data type?
Why is a singleton bad?
What is the full meaning of java?
What are the two parts of a conditional statement?
Can we serialize singleton class?
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. (
Difference between concurrent hashmap and hashtable and collections
Print Vertical traversal of a Binary Tree.
What is bool mean?
Is double bigger than float?
Difference between static synchronization vs. Instance synchronization?
What is the implementation of destroy method in java. Is it native or java code?
If I only change the return type, does the method become overloaded?
Describe method overriding