114
Java Vector size() Method
The size() method of Java Vector class is used to get the number of components presents in the vector.
Syntax
Following is the declaration of size() method:
Parameter
This method does not accept any parameter.
Return
The size() method returns the number of components presents in a vector.
Exceptions
NA
Compatibility Version
Java 1.2 and above
Example 1
Output:
The vector Element is = [10, 20, 30, 40, 50] Size of the vector is = 5
Example 2
Output:
Size of the vector is = 4
Next TopicJava Vector Sort Method