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
How many bytes is string in java?
What are the two ways of implementing multi-threading in java?
Justify your answer that you can't define a method inside another method in java, if you can then how?
Garbage collection in java?
Do I need java for windows 10?
How to reverse string in java?
What is sizeof () operator?
What is numel matlab?
Why synchronization is important?
What is the byte order of byte buffer?
What is an example of a boolean?
How will you communicate between two applets?
Explain the difference between map and flatmap stream operation?
Can a final variable be manipulated in java?
Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?