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

What is the requirement of thread in java?

610


Which is easier netbeans or eclipse?

602


What is the char data type?

513


What is the purpose of using the java bean?

565


What is an iterator interface in java programming?

527






What are the different types of java?

550


Are arrays static in java?

577


What are exceptions

635


What are the advantages of java over cpp?

545


why Interface used?

529


Can a main method be declared final?

578


What is anagram number?

451


What are filterstreams?

602


What is namespace in java?

535


Why do we need hashset in java?

486