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 do u mean by variable?

801


What is primitive array?

692


What is public/private protected in java?

793


What is the base class of all exception classes?

818


what are different ways in which a thread can enter the waiting state? : Java thread

721


Which are the two subclasses under exception class?

762


What is variable argument in java?

775


Is there any limitation of using inheritance?

820


What does ide stand for?

711


What is an association?

766


What is a programming object?

784


how to write a server program and sending the mails to the server using smtp protocol please help me

1796


Does java runtime require a license?

785


What is floor math?

699


What are variable arguments or varargs?

796