Difference between Array and vector?

Answer Posted / meghana

Array:
1)Size of array need to be declared in advance.
2)Once declared array can't grow in size.
3)Array can store primitive data types.like int,char,...
Vector:
1) No need to declare the size of vector. You may give its
size & you may not.
2) Vector can always grow in size if you start adding more
element to it than your declared size.
3) Vector can store only object references. Storing
primitive data types is not possible in case of vectors.

Is This Answer Correct ?    25 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a singleton class be inherited?

746


When should I use stringbuffer?

803


java Technical questions asked by JPMC

4824


How many bytes is double?

773


What does java final mean?

751


Do I need java on my computer?

757


What is sizeof () operator?

771


Can we access the non-final local variable, inside the local inner class?

800


why are there separate wait and sleep methods? : Java thread

822


What is a stack class in java ?

881


What is a ?

991


Explain the use of shift operator in java. Can you give some examples?

759


When does an object becomes eligible for garbage collection in java?

844


What is getclass () getname () in java?

917


What is the difference between the direct buffer and non-direct buffer in java?

829