What is an array and a vector? How they different from each
other?
Answer Posted / ranganathkini
An array represents a contiguous block of memory where
objects are stored and accessed via a 0-based index value.
Arrays are usually fixed size once they are created.
A java.util.Vector is an implementation of a resizable
array. It has similar functionality as an array but also
gives the advantage of resizability when u try to add
elements to it exceeding its initial size.
The problem is that Vectors are synchronized which is not
necessary for many purposes and this may bring down
performance. Hence the use of ArrayList over Vecotor is
recommended. An ArrayList provides the same functionality of
a Vector, except tat it is not synchronized.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the exception hierarchy in java?
What is the protected method modifier?
what is the purpose of "virtual"?
What is the exact difference in between Unicast and Multicast object? Where will it be used?
What is nested top-level class?
What is qms certification?
What do you mean by singleton class in java?
What is variable length arguments in java?
Why is string builder not thread safe?
What is the internal implementation of set in java?
What are the benefits of operations?
How do generics work?
What is == mean?
What is the difference between iterator and enumeration ?
Is null a string or object in java?