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 default execution method in java?
What is the main use of java?
What are the advantages of inner classes?
What is pre increment and post increment in java?
Is java a super set of javascript?
What does sizeof return?
Why java is platform independent? Explain.
What is better - 'bit-shift a value' or 'multiply by 2'?
Which class cannot be a subclass in java?
What is a map in java?
What is the difference between the direct buffer and non-direct buffer in java?
Which collection is sorted in java?
Can we have 2 main methods in java class?
Explain different types of thread priorities ?
Is a string literal?