by Dinesh Thakur Category: Data Type

Vectors:- We know that Arrays are very useful when there is a need to use number of variables But There is a problem with Array they use only single data type or The Elements of array are always Same type For Avoiding this Problem Vectors are used.

These are also Collection of elements those are object data type For Using Vectors we have to import java.util package These are also Called as dynamic Array of object data type .

 

But Always Remember vectors doesn’t support primitives data types like int, float, char etc. For Creating a Vector, Vector Class will be used which is reside in java’s utility package

 

Various Methods those are used with vectors:-

 

1.addElement:- For Inserting an element into Vector

2.elementAt:- Gives the name of Char at position

3.size:- Give us Size of Number of Elements in Vector

4.copyInto:- For Copying All Elemnts insto an Array

5.insertElementAt(ele,n):- For Inserting an Element ele into the nth Position



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content