Java Vector addElement() MethodThe addElement() method of Java Vector class is used to add the specified element to the end of this vector. Adding an element increases the vector size by one. Syntax:Following is the declaration of addElement() method: Parameter:
Returns:The addElement() method does not return anything because its return type is void. Exceptions:NA Compatibility Version:Java 1.2 and above Example 1:Test it NowOutput: --Elements of Vector are-- Element= A Element= B Element= C ---Elements after addition--- Element= A Element= B Element= C Element= JavaTpoint Example 2:Test it NowOutput: Elements of Vector are: [101, -201, 301] Elements of vector after addition: [101, -201, 301, -5001] 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