Java Vector addElement() MethodLast Updated : 17 Mar 2025 The 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:Output: --Elements of Vector are-- Element= A Element= B Element= C ---Elements after addition--- Element= A Element= B Element= C Element= JavaTpoint Example 2:Output: Elements of Vector are: [101, -201, 301] Elements of vector after addition: [101, -201, 301, -5001] Next TopicJava Vector |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India