Java Vector capacity() MethodThe capacity() method of Java Vector class is used to get the current capacity of the vector which is in use. Syntax:Following is the declaration of capacity() method: Parameter:This method does not accept any parameter. Returns:This method returns the current capacity of the vector which is in use. Exceptions:NA Compatibility Version:Java 1.2 and above Example 1:Test it NowOutput: Current capacity of Vector is: 5 Example 2:Test it NowOutput: Elements of Vector are: [A, B, C] Current capacity of Vector: 3 Elements after addition: [A, B, C, JavaTpoint] Current capacity of Vector after modification: 6 Example 3:Test it NowOutput: Default capacity of Vector: 10 Next TopicJava Vector |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India