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 byte data type?

546


Can we have return statement in finally clause? What will happen?

510


What is diamond operator in java?

495


What java is used for?

656


What is boolean keyword in java?

599






What is a container in a gui?

545


Why does java have different data types for integers and floating-point values?

529


Can you give names of Container classes?

1851


Name few "optional" classes introduced with java 8 ?

641


How do you check if a string contains only numeric digits?

615


What is exception hierarchy in java?

585


What are different types of inner classes ?

555


Give me some null interfaces in java?

598


Explain the access modifiers for a class, method and variables?

650


how can you catch multiple exceptions in java?

541