Java Vector size() Method
The size() method of Java Vector class is used to get the number of components presents in the vector.
Following is the declaration of size() method:
This method does not accept any parameter.
The size() method returns the number of components presents in a vector.
Java 1.2 and above
Example 1Test it Now
The vector Element is = [10, 20, 30, 40, 50] Size of the vector is = 5
Example 2Test it Now
Size of the vector is = 4